annotate libvo/vo_tdfxfb.c @ 7244:1dcd9cc4f801

allow to specify freetype-config and restrict to freetype 2.1.x+
author atmos4
date Mon, 02 Sep 2002 18:43:01 +0000
parents 9a44c38d388c
children c1e8287f9574
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.
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
18 *
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
19 * Hints and tricks:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
20 * - Use -dr to get direct rendering
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
26 */
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
27
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
28 #include <stdio.h>
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
31 #include <sys/ioctl.h>
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
32 #include <fcntl.h>
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
33 #include <sys/mman.h>
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
34 #include <linux/fb.h>
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
35
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
36 #include "config.h"
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
37 #include "fastmemcpy.h"
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
38 #include "video_out.h"
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
39 #include "video_out_internal.h"
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
40 #include "drivers/3dfx.h"
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
41
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
42 LIBVO_EXTERN(tdfxfb)
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
45 {
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
46 "3Dfx Banshee/Voodoo3/Voodoo5",
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
49 ""
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
50 };
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
66 static struct fb_fix_screeninfo fb_finfo;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
67 static struct fb_var_screeninfo fb_vinfo;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
73 static voodoo_2d_reg *reg_2d;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
79 {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
80 char *name;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
84
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
88 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
89
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
92 strerror(errno));
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
93 return -1;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
94 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
95
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
98 strerror(errno));
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
99 return -1;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
100 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
101
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
102 /* BANSHEE means any of the series aparently */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
103 if (fb_finfo.accel != FB_ACCEL_3DFX_BANSHEE) {
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
104 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
105 " Voodoo3 and Voodoo 5\n");
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
106 return -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
107 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
117 return -1;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
121 reg_IO = (void *)memBase0 + VOODOO_IO_REG_OFFSET;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
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
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
154 static void clear_screen()
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
155 {
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
156 /* 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
157 * 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
158 * 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
159 * 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
160 * the card.
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
161 */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
162 if(vo_doublebuffering) {
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
163 /* 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
164 * every time - alex */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
165 do {} while((reg_IO->status & 0x1f) < 1);
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
166 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
167 memset(hidpage, 0, screenwidth * screenheight * screendepth);
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
168 }
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
169 }
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
170
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
171 /* Setup output screen dimensions etc */
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
172 static void setup_screen(uint32_t full)
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
173 {
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
174 fs = full;
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
175
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
176 if(fs) { /* Full screen */
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
177 double ratio = (double)in_width / in_height;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
178 vidwidth = screenwidth;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
179 vidheight = screenheight;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
180
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
181 if(screenwidth / ratio <= screenheight)
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
182 vidheight = (double)screenwidth / ratio;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
183 else
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
184 vidwidth = (double)screenheight * ratio;
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
185
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
186 vidx = (screenwidth - vidwidth) / 2;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
187 vidy = (screenheight - vidheight) / 2;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
188 } else { /* Reset to normal size */
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
189 if(r_width > screenwidth || r_height > screenheight)
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
190 printf("tdfxfb: your resolution is too small to display "
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
191 "the whole movie...\n");
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
192
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
193 vidwidth = r_width;
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
194 vidheight = r_height;
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
195 vidx = vidy = 0;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
196 }
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
197
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
198 clear_screen();
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
199 }
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
200
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
201 static uint32_t 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
202 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
203 {
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
204 screenwidth = fb_vinfo.xres;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
205 screenheight = fb_vinfo.yres;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
206
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
207 in_width = width;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
208 in_height = height;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
209 in_format = format;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
210
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
211 r_width = d_width;
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
212 r_height = d_height;
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
213
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
214 /* Setup the screen for rendering to */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
215 switch(fb_vinfo.bits_per_pixel) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
216 case 16:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
217 screendepth = 2;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
218 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
219 alpha_func_double = vo_draw_alpha_rgb16;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
220 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
221
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
222 case 24:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
223 screendepth = 3;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
224 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
225 alpha_func_double = vo_draw_alpha_rgb24;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
226 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
227
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
228 case 32:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
229 screendepth = 4;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
230 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
231 alpha_func_double = vo_draw_alpha_rgb32;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
232 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
233
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
234 default:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
235 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
236 return -1;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
237 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
238
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
239 vid_voodoo_format |= screenwidth * screendepth;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
240
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
241 /* Some defaults here */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
242 in_voodoo_format = VOODOO_BLT_FORMAT_YUYV;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
243 in_depth = 2;
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
244 alpha_func = vo_draw_alpha_yuy2;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
245
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
246 switch(in_format) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
247 case IMGFMT_YV12:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
248 case IMGFMT_I420:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
249 case IMGFMT_IYUV:
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
250 case IMGFMT_YUY2:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
251 break;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
252
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
253 case IMGFMT_BGR16:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
254 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
255 alpha_func = vo_draw_alpha_rgb16;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
256 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
257
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
258 case IMGFMT_BGR24:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
259 in_depth = 3;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
260 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
261 alpha_func = vo_draw_alpha_rgb24;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
262 break;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
263
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
264 case IMGFMT_BGR32:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
265 in_depth = 4;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
266 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
267 alpha_func = vo_draw_alpha_rgb32;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
268 break;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
269
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
270 default:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
271 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
272 return -1;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
273 }
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 in_voodoo_format |= in_width * in_depth;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
276
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
277 /* Linux lives in the first frame */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
278 if(vo_doublebuffering) {
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
279 vidpageoffset = screenwidth * screenheight * screendepth;
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
280 hidpageoffset = vidpageoffset + screenwidth * screenheight * screendepth;
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
281 } else
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
282 vidpageoffset = hidpageoffset = 0; /* Console background */
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
283
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
284
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
285 inpageoffset = hidpageoffset + screenwidth * screenheight * screendepth;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
286
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
287 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
288 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
289 return -1;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
290 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
291
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
292 vidpage = (void *)memBase1 + (unsigned long)vidpageoffset;
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
293 hidpage = (void *)memBase1 + (unsigned long)hidpageoffset;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
294 inpage = (void *)memBase1 + (unsigned long)inpageoffset;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
295
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
296 setup_screen(flags & VOFLAG_FULLSCREEN);
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
297
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
298 memset(inpage, 0, in_width * in_height * in_depth);
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
299
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
300 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
301 screenwidth, screenheight, screendepth * 8,
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
302 in_width, in_height, in_depth * 8,
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
303 d_width, d_height);
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
304
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
305 return 0;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
306 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
307
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
308 /* Double-buffering draw_alpha */
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
309 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
310 unsigned char *srca, int stride)
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
311 {
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
312 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
313 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
314 }
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 /* Single-buffering draw_alpha */
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
317 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
318 unsigned char *srca, int stride)
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
319 {
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
320 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
321 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
322 }
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
323
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
324 static void draw_osd(void)
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
325 {
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 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
328 }
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
329
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
330 /* Render onto the screen */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
331 static void flip_page(void)
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
332 {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
333 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
334 int i = 0;
7113
3c84ee5e7da1 clear screen and tiny image bug patch by Burton Samograd <kruhft@kruhft.dyndns.org>
alex
parents: 5607
diff changeset
335 /* This has to be done of else setting dstSize doesn't work */
3c84ee5e7da1 clear screen and tiny image bug patch by Burton Samograd <kruhft@kruhft.dyndns.org>
alex
parents: 5607
diff changeset
336 /* Must be a gcc 3.0+ bug */
3c84ee5e7da1 clear screen and tiny image bug patch by Burton Samograd <kruhft@kruhft.dyndns.org>
alex
parents: 5607
diff changeset
337 int tempvidheight = vidheight;
3c84ee5e7da1 clear screen and tiny image bug patch by Burton Samograd <kruhft@kruhft.dyndns.org>
alex
parents: 5607
diff changeset
338 int tempvidwidth = vidwidth;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
339
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
340 if(vo_doublebuffering) {
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
341 /* 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
342 uint32_t t = vidpageoffset;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
343 void *j = vidpage;
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
344
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
345 vidpage = hidpage;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
346 hidpage = j;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
347 vidpageoffset = hidpageoffset;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
348 hidpageoffset = t;
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
349 }
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
350
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
351 reg_2d->commandExtra = 0;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
352 reg_2d->clip0Min = 0;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
353 reg_2d->clip0Max = 0xffffffff;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
354
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
355 reg_2d->srcBaseAddr = inpageoffset;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
356 reg_2d->srcXY = 0;
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
357 reg_2d->srcFormat = in_voodoo_format;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
358 reg_2d->srcSize = XYREG(in_width, in_height);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
359
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
360 reg_2d->dstBaseAddr = vidpageoffset;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
361 reg_2d->dstXY = XYREG(vidx, vidy);
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
362 reg_2d->dstFormat = vid_voodoo_format;
7113
3c84ee5e7da1 clear screen and tiny image bug patch by Burton Samograd <kruhft@kruhft.dyndns.org>
alex
parents: 5607
diff changeset
363 /* The XYREG macro doesn't seem to work for this line so build the register contents very explicitly */
7137
9a44c38d388c Fixed some breakages of single-buffer rendering of tdfx
mark
parents: 7124
diff changeset
364 reg_2d->dstSize = XYREG(vidwidth, vidheight);
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
365 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
366
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
367 /* 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
368 * sound corruption... */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
369 while((reg_IO->status & 0x1f) < 1)
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
370 /* Wait */;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
371
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
372 *((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
373
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
374 while(i < 3)
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
375 if(!(reg_IO->status & STATUS_BUSY))
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
376 i++;
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 /* Restore the old regs now */
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
379 reg_2d->commandExtra = regs.commandExtra;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
380 reg_2d->clip0Min = regs.clip0Min;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
381 reg_2d->clip0Max = regs.clip0Max;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
382
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
383 reg_2d->srcBaseAddr = regs.srcBaseAddr;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
384 reg_2d->srcXY = regs.srcXY;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
385 reg_2d->srcFormat = regs.srcFormat;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
386 reg_2d->srcSize = regs.srcSize;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
387
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
388 reg_2d->dstBaseAddr = regs.dstBaseAddr;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
389 reg_2d->dstXY = regs.dstXY;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
390 reg_2d->dstFormat = regs.dstFormat;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
391 reg_2d->dstSize = regs.dstSize;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
392
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
393 reg_2d->command = 0;
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
394
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
395 /* 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
396 if(vo_doublebuffering)
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
397 vo_draw_text(vidwidth, vidheight, draw_alpha_double);
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
398
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
399 /* And flip to the new buffer! */
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
400 reg_IO->vidDesktopStartAddr = vidpageoffset;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
401 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
402
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
403 static uint32_t draw_frame(uint8_t *src[])
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
404 {
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
405 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
406 return 0;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
407 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
408
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
409 static uint32_t 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
410 {
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
411 /* 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
412 * of the stripes we're doing */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
413 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
414 reg_YUV->yuvStride = in_width * in_depth;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
415
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
416 /* 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
417 * thingie */
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
418 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
419 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
420 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
421 return 0;
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
422 }
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
423
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
424 /* Attempt to start doing DR */
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
425 static uint32_t get_image(mp_image_t *mpi)
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
426 {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
427 static int enabled = 0;
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
428
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
429 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
430 return VO_FALSE;
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
431
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
432 switch(in_format) {
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
433 case IMGFMT_YUY2:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
434 case IMGFMT_BGR16:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
435 case IMGFMT_BGR24:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
436 case IMGFMT_BGR32:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
437 mpi->planes[0] = (char *)inpage;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
438 mpi->stride[0] = in_width * in_depth;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
439 break;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
440
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
441 case IMGFMT_YV12:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
442 case IMGFMT_I420:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
443 case IMGFMT_IYUV:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
444 if(!enabled)
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
445 if(!(mpi->flags & MP_IMGFLAG_ACCEPT_STRIDE))
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
446 return VO_FALSE;
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
447
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
448 mpi->planes[0] = YUV->Y;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
449 mpi->planes[1] = YUV->U;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
450 mpi->planes[2] = YUV->V;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
451 mpi->stride[0] = mpi->stride[1] = mpi->stride[2] = YUV_STRIDE;
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
452 break;
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
453
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
454 default:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
455 return VO_FALSE;
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
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
458 if(!enabled) {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
459 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
460 enabled = 1;
2350
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
461 }
d3a67a417352 new version by zsteva@ptt.yu
arpi
parents: 1979
diff changeset
462
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
463 mpi->width = in_width;
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
464 mpi->flags |= MP_IMGFLAG_DIRECT;
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
465
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
466 return VO_TRUE;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2732
diff changeset
467 }
1979
6278f566cd91 tdfxfb yuv driver by Zeljko Stevanovic <zsteva@ptt.yu>
arpi
parents:
diff changeset
468
4596
c35d7ce151b3 10000hl to Holm... control MUST BE static...
arpi
parents: 4592
diff changeset
469 static uint32_t control(uint32_t request, void *data, ...)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2732
diff changeset
470 {
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
471 switch(request) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
472 case VOCTRL_GET_IMAGE:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
473 return get_image(data);
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
474
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
475 case VOCTRL_QUERY_FORMAT:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
476 switch(*((uint32_t*)data)) {
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
477 case IMGFMT_YV12:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
478 case IMGFMT_I420:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
479 case IMGFMT_IYUV:
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
480 case IMGFMT_YUY2:
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
481 case IMGFMT_BGR16:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
482 case IMGFMT_BGR24:
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
483 case IMGFMT_BGR32:
5579
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
484 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW |
2250b6ad5ad9 Some OSD and other random fixes. Added double buffering
mark
parents: 5567
diff changeset
485 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
486 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
487
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
488 return 0; /* Not supported */
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
489
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
490 case VOCTRL_FULLSCREEN:
5590
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
491 setup_screen(!fs);
cd591b2fa883 Misc cleanups of the code
mark
parents: 5580
diff changeset
492 return 0;
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
493 }
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
494
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
495 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 2732
diff changeset
496 }
5540
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
497
80d8fed6e683 new tdfxfb yuv driver by Mark Zealey <mark@zealos.org>
arpi
parents: 4737
diff changeset
498 /* Dummy funcs */
5580
6366586083bb Added support for choosing weather to use double-buffering or single buffering
mark
parents: 5579
diff changeset
499 static void check_events(void) {}
5567
cfa4a2c0366e Lots of updates and bugfixes to the tdfxfb driver
mark
parents: 5540
diff changeset
500 static const vo_info_t* get_info(void) { return &vo_info; }