annotate libvo/vo_tdfxfb.c @ 16733:d45ad3a15212

partial sync by Emfox Zhou < emfoxzhou -- at -- gmail -- dot com >
author diego
date Tue, 11 Oct 2005 23:26:16 +0000
parents fd51fd1ff231
children a107276371a8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
1 /* Copyright (C) Mark Zealey, 2002, <mark@zealos.org>. Released under the terms
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
2 * and conditions of the GPL.
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
9 * 09/04/02: Fixed a problem with changing the variables passed to draw_slice().
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
10 * Fixed DR support for YV12 et al. Added BGR support. Removed lots of dud code.
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
11 * 10/04/02: Changed the memcpy functions to mem2agpcpy.. should be a tad
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
12 * faster.
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
13 * 11/04/02: Added a compile option so you can watch the film with the console
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
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
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
17 * 13/04/02: Misc cleanups of the code.
7866
732a8bfc7681 Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents: 7708
diff changeset
18 * 22/10/02: Added geometry support to it
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
19 *
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
20 * Hints and tricks:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
21 * - Use -dr to get direct rendering
11261
835822ce4bb1 -vop ---> -vf
diego
parents: 11129
diff changeset
22 * - 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
23 * - 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
24 * - 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
25 * - 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
26 * -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
27 * option.
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
28 */
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
29
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
30 #include <stdio.h>
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
31 #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
32 #include <errno.h>
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
33 #include <string.h>
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
34 #include <unistd.h>
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
35 #include <sys/ioctl.h>
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
36 #include <fcntl.h>
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
37 #include <sys/mman.h>
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
38 #include <linux/fb.h>
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
39
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
40 #include "config.h"
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
41 #include "fastmemcpy.h"
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
42 #include "video_out.h"
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
43 #include "video_out_internal.h"
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
44 #include "drivers/3dfx.h"
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
45 #include "aspect.h"
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7866
diff changeset
46 #include "sub.h"
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
47
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8123
diff changeset
48 static vo_info_t info =
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
49 {
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
50 "3Dfx Banshee/Voodoo3/Voodoo5",
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
51 "tdfxfb",
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
52 "Mark Zealey <mark@zealos.org>",
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
53 ""
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
54 };
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
55
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8123
diff changeset
56 LIBVO_EXTERN(tdfxfb)
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 8123
diff changeset
57
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
58 /* Some registers on the card */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
59 #define S2S_STRECH_BLT 2 // BLT + Strech
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
60 #define S2S_IMMED (1 << 8) // Do it immediatly
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
61 #define S2S_ROP (0xCC << 24) // ???
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
62
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
63 /* Stepping between the different YUV plane registers */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
64 #define YUV_STRIDE 1024
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
65 struct YUV_plane {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
66 char Y[0x0100000];
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
67 char U[0x0100000];
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
68 char V[0x0100000];
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
69 };
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
70
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
71 static int fd = -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
72 static struct fb_fix_screeninfo fb_finfo;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
73 static struct fb_var_screeninfo fb_vinfo;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
74 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
75 screenwidth, screenheight, screendepth, vidwidth, vidheight, vidx, vidy,
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
76 vid_voodoo_format, *vidpage, *hidpage, *inpage, vidpageoffset,
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
77 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
78 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
79 static volatile voodoo_2d_reg *reg_2d;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
80 static voodoo_yuv_reg *reg_YUV;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
81 static struct YUV_plane *YUV;
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
82 static void (*alpha_func)(), (*alpha_func_double)();
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
83
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 11261
diff changeset
84 static int preinit(const char *arg)
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
85 {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
86 char *name;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
87
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
88 if(arg)
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
89 name = (char*)arg;
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
90 else if(!(name = getenv("FRAMEBUFFER")))
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
91 name = "/dev/fb0";
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
92
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
93 if((fd = open(name, O_RDWR)) == -1) {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
94 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
95 return -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
96 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
97
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
98 if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
99 printf("tdfxfb: problem with FBITGET_FSCREENINFO ioctl: %s\n",
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
100 strerror(errno));
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
101 close(fd);
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
102 fd = -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
103 return -1;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
104 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
105
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
106 if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
107 printf("tdfxfb: problem with FBITGET_VSCREENINFO ioctl: %s\n",
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
108 strerror(errno));
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
109 close(fd);
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
110 fd = -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
111 return -1;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
112 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
113
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
114 /* BANSHEE means any of the series aparently */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
115 if (fb_finfo.accel != FB_ACCEL_3DFX_BANSHEE) {
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
116 printf("tdfxfb: This driver is only supports the 3Dfx Banshee,"
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
117 " Voodoo3 and Voodoo 5\n");
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
118 close(fd);
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
119 fd = -1;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
120 return -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
121 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
122
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
123 // Check the depth now as config() musn't fail
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
124 switch(fb_vinfo.bits_per_pixel) {
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
125 case 16:
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
126 case 24:
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
127 case 32:
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
128 break; // Ok
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
129 default:
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
130 printf("tdfxfb: %d bpp output is not supported\n", fb_vinfo.bits_per_pixel);
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
131 close(fd);
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
132 fd = -1;
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
133 return -1;
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
134 }
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
135
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
136 /* Open up a window to the hardware */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
137 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
138 MAP_SHARED, fd, 0);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
139 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
140 MAP_SHARED, fd, fb_finfo.smem_len);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
141
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
142 if((long)memBase0 == -1 || (long)memBase1 == -1) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
143 printf("tdfxfb: Couldn't map memory areas: %s\n", strerror(errno));
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
144 if((long)memBase0 != -1)
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
145 munmap(memBase0, fb_finfo.smem_len);
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
146 if((long)memBase1 != -1)
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
147 munmap(memBase1, fb_finfo.smem_len);
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
148 memBase0 = memBase1 = NULL;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
149 return -1;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
150 }
5540
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 /* Set up global pointers to the voodoo's regs */
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
153 reg_IO = (void *)memBase0 + VOODOO_IO_REG_OFFSET;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
154 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
155 reg_YUV = (void *)memBase0 + VOODOO_YUV_REG_OFFSET;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
156 YUV = (void *)memBase0 + VOODOO_YUV_PLANE_OFFSET;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
157
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
158 return 0;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
159 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
160
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
161 static void uninit(void)
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
162 {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
163 if(reg_IO) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
164 /* Restore the screen (Linux lives at 0) */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
165 reg_IO->vidDesktopStartAddr = 0;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
166 reg_IO = NULL;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
167 }
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
168
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
169 /* And close our mess */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
170 if(memBase1) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
171 munmap(memBase1, fb_finfo.smem_len);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
172 memBase1 = NULL;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
173 }
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
174
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
175 if(memBase0) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
176 munmap(memBase0, fb_finfo.mmio_len);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
177 memBase0 = NULL;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
178 }
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 if(fd != -1) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
181 close(fd);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
182 fd = -1;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
183 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
184 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
185
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
186 static void clear_screen()
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
187 {
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
188 /* 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
189 * 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
190 * 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
191 * 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
192 * the card.
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
193 */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
194 if(vo_doublebuffering) {
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
195 /* 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
196 * every time - alex */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
197 do {} while((reg_IO->status & 0x1f) < 1);
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
198 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
199 memset(hidpage, 0, screenwidth * screenheight * screendepth);
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
200 }
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
201 }
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
202
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
203 /* Setup output screen dimensions etc */
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
204 static void setup_screen(uint32_t full)
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
205 {
7866
732a8bfc7681 Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents: 7708
diff changeset
206 aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM);
9517
d65ddafbc404 clean up of -geometry code.
attila
parents: 8745
diff changeset
207
9521
7de2fabb1fa2 Fixed geometry that someone broke grr.
mark
parents: 9517
diff changeset
208 geometry(&vidx, &vidy, &vidwidth, &vidheight, screenwidth, screenheight);
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
209 vo_fs = full;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
210 clear_screen();
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
211 }
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
212
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 11261
diff changeset
213 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
214 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
215 {
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
216 screenwidth = fb_vinfo.xres;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
217 screenheight = fb_vinfo.yres;
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
218 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
219
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
220 in_width = width;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
221 in_height = height;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
222 in_format = format;
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
223 aspect_save_orig(width,height);
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
224
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
225 r_width = d_width;
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
226 r_height = d_height;
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
227 aspect_save_prescale(d_width,d_height);
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
228
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
229 /* Setup the screen for rendering to */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
230 switch(fb_vinfo.bits_per_pixel) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
231 case 16:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
232 screendepth = 2;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
233 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
234 alpha_func_double = vo_draw_alpha_rgb16;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
235 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
236
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
237 case 24:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
238 screendepth = 3;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
239 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
240 alpha_func_double = vo_draw_alpha_rgb24;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
241 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
242
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
243 case 32:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
244 screendepth = 4;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
245 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
246 alpha_func_double = vo_draw_alpha_rgb32;
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
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
249 default:
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
250 printf("tdfxfb: %d bpp output is not supported (This should never happend)\n", fb_vinfo.bits_per_pixel);
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
251 return -1;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
252 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
253
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
254 vid_voodoo_format |= screenwidth * screendepth;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
255
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
256 /* Some defaults here */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
257 in_voodoo_format = VOODOO_BLT_FORMAT_YUYV;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
258 in_depth = 2;
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
259 alpha_func = vo_draw_alpha_yuy2;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
260
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
261 switch(in_format) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
262 case IMGFMT_YV12:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
263 case IMGFMT_I420:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
264 case IMGFMT_IYUV:
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
265 case IMGFMT_YUY2:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
266 break;
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
267 case IMGFMT_UYVY:
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
268 in_voodoo_format = VOODOO_BLT_FORMAT_UYVY;
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
269 break;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
270 case IMGFMT_BGR16:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
271 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
272 alpha_func = vo_draw_alpha_rgb16;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
273 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
274
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
275 case IMGFMT_BGR24:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
276 in_depth = 3;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
277 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
278 alpha_func = vo_draw_alpha_rgb24;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
279 break;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
280
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
281 case IMGFMT_BGR32:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
282 in_depth = 4;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
283 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
284 alpha_func = vo_draw_alpha_rgb32;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
285 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
286
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
287 default:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
288 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
289 return -1;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
290 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
291
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
292 in_voodoo_format |= in_width * in_depth;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
293
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
294 /* Linux lives in the first frame */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
295 if(vo_doublebuffering) {
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
296 vidpageoffset = screenwidth * screenheight * screendepth;
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
297 hidpageoffset = vidpageoffset + screenwidth * screenheight * screendepth;
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
298 } else
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
299 vidpageoffset = hidpageoffset = 0; /* Console background */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
300
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
301
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
302 inpageoffset = hidpageoffset + screenwidth * screenheight * screendepth;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
303
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
304 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
305 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
306 return -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
307 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
308
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
309 vidpage = (void *)memBase1 + (unsigned long)vidpageoffset;
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
310 hidpage = (void *)memBase1 + (unsigned long)hidpageoffset;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
311 inpage = (void *)memBase1 + (unsigned long)inpageoffset;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
312
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
313 setup_screen(flags & VOFLAG_FULLSCREEN);
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
314
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
315 memset(inpage, 0, in_width * in_height * in_depth);
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
316
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
317 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
318 screenwidth, screenheight, screendepth * 8,
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
319 in_width, in_height, in_depth * 8,
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
320 d_width, d_height);
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
321
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
322 return 0;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
323 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
324
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
325 /* Double-buffering draw_alpha */
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
326 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
327 unsigned char *srca, int stride)
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
328 {
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
329 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
330 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
331 }
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
332
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
333 /* Single-buffering draw_alpha */
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
334 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
335 unsigned char *srca, int stride)
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
336 {
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
337 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
338 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
339 }
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
340
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
341 static void draw_osd(void)
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
342 {
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
343 if(!vo_doublebuffering)
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
344 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
345 }
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
346
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
347 /* Render onto the screen */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
348 static void flip_page(void)
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
349 {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
350 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
351 int i = 0;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
352
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
353 if(vo_doublebuffering) {
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
354 /* 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
355 uint32_t t = vidpageoffset;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
356 void *j = vidpage;
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
357
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
358 vidpage = hidpage;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
359 hidpage = j;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
360 vidpageoffset = hidpageoffset;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
361 hidpageoffset = t;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
362 }
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
363
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
364 reg_2d->commandExtra = 0;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
365 reg_2d->clip0Min = 0;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
366 reg_2d->clip0Max = 0xffffffff;
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 = inpageoffset;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
369 reg_2d->srcXY = 0;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
370 reg_2d->srcFormat = in_voodoo_format;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
371 reg_2d->srcSize = XYREG(in_width, in_height);
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 = vidpageoffset;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
374 reg_2d->dstXY = XYREG(vidx, vidy);
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
375 reg_2d->dstFormat = vid_voodoo_format;
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
376 reg_2d->dstSize = XYREG(vidwidth, vidheight);
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
377 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
378
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
379 /* 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
380 * sound corruption... */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
381 while((reg_IO->status & 0x1f) < 1)
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
382 /* Wait */;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
383
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
384 *((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
385
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
386 while(i < 3)
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
387 if(!(reg_IO->status & STATUS_BUSY))
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
388 i++;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
389
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
390 /* Restore the old regs now */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
391 reg_2d->commandExtra = regs.commandExtra;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
392 reg_2d->clip0Min = regs.clip0Min;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
393 reg_2d->clip0Max = regs.clip0Max;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
394
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
395 reg_2d->srcBaseAddr = regs.srcBaseAddr;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
396 reg_2d->srcXY = regs.srcXY;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
397 reg_2d->srcFormat = regs.srcFormat;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
398 reg_2d->srcSize = regs.srcSize;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
399
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
400 reg_2d->dstBaseAddr = regs.dstBaseAddr;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
401 reg_2d->dstXY = regs.dstXY;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
402 reg_2d->dstFormat = regs.dstFormat;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
403 reg_2d->dstSize = regs.dstSize;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
404
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
405 reg_2d->command = 0;
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
406
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
407 /* 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
408 if(vo_doublebuffering)
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
409 vo_draw_text(vidwidth, vidheight, draw_alpha_double);
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
410
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
411 /* And flip to the new buffer! */
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
412 reg_IO->vidDesktopStartAddr = vidpageoffset;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
413 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
414
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 11261
diff changeset
415 static int draw_frame(uint8_t *src[])
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
416 {
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
417 mem2agpcpy(inpage, src[0], in_width * in_depth * in_height);
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
418 return 0;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
419 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
420
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 11261
diff changeset
421 static int draw_slice(uint8_t *i[], int s[], int w, int h, int x, int y)
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
422 {
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
423 /* We want to render to the YUV to the input page + the location
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
424 * of the stripes we're doing */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
425 reg_YUV->yuvBaseAddr = inpageoffset + in_width * in_depth * y + x;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
426 reg_YUV->yuvStride = in_width * in_depth;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
427
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
428 /* Put the YUV channels into the voodoos internal combiner unit
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
429 * thingie */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
430 mem2agpcpy_pic(YUV->Y, i[0], s[0], h , YUV_STRIDE, s[0]);
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
431 mem2agpcpy_pic(YUV->U, i[1], s[1], h / 2, YUV_STRIDE, s[1]);
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
432 mem2agpcpy_pic(YUV->V, i[2], s[2], h / 2, YUV_STRIDE, s[2]);
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
433 return 0;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
434 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
435
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
436 /* Attempt to start doing DR */
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
437 static uint32_t get_image(mp_image_t *mpi)
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
438 {
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
439
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
440 if(mpi->flags & MP_IMGFLAG_READABLE)
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
441 return VO_FALSE;
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
442 if(mpi->type == MP_IMGTYPE_STATIC && vo_doublebuffering)
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
443 return VO_FALSE;
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
444 if(mpi->type > MP_IMGTYPE_TEMP)
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
445 return VO_FALSE; // TODO ??
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
446
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
447 switch(in_format) {
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
448 case IMGFMT_YUY2:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
449 case IMGFMT_BGR16:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
450 case IMGFMT_BGR24:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
451 case IMGFMT_BGR32:
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
452 case IMGFMT_UYVY:
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
453 mpi->planes[0] = (char *)inpage;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
454 mpi->stride[0] = in_width * in_depth;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
455 break;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
456
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
457 case IMGFMT_YV12:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
458 case IMGFMT_I420:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
459 case IMGFMT_IYUV:
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
460 if(!(mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE) && mpi->w != YUV_STRIDE)
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
461 return VO_FALSE;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
462 mpi->planes[0] = YUV->Y;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
463 mpi->planes[1] = YUV->U;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
464 mpi->planes[2] = YUV->V;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
465 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = YUV_STRIDE;
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
466 reg_YUV->yuvBaseAddr = inpageoffset;
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
467 reg_YUV->yuvStride = in_width * in_depth;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
468 break;
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
469
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
470 default:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
471 return VO_FALSE;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
472 }
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
473
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
474 mpi->width = in_width;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
475 mpi->flags |= MP_IMGFLAG_DIRECT;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
476
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
477 return VO_TRUE;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2732
diff changeset
478 }
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
479
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 11261
diff changeset
480 static int control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2732
diff changeset
481 {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
482 switch(request) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
483 case VOCTRL_GET_IMAGE:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
484 return get_image(data);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
485
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
486 case VOCTRL_QUERY_FORMAT:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
487 switch(*((uint32_t*)data)) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
488 case IMGFMT_YV12:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
489 case IMGFMT_I420:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
490 case IMGFMT_IYUV:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
491 case IMGFMT_YUY2:
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
492 case IMGFMT_UYVY:
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
493 case IMGFMT_BGR16:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
494 case IMGFMT_BGR24:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
495 case IMGFMT_BGR32:
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
496 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
497 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
498 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
499
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
500 return 0; /* Not supported */
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
501
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
502 case VOCTRL_FULLSCREEN:
7708
c1e8287f9574 Use the common aspect code
albeu
parents: 7137
diff changeset
503 setup_screen(!vo_fs);
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
504 return 0;
5540
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
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
507 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2732
diff changeset
508 }
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
509
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
510 /* Dummy funcs */
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
511 static void check_events(void) {}