annotate libvo/vo_3dfx.c @ 33724:c919fb3d2531

Rename guiGetEvent() gui(). This function is the interface between MPlayer and the GUI. It doesn't have much to do with events and doesn't merely get things.
author ib
date Tue, 05 Jul 2011 09:33:09 +0000
parents ddb45e9443ec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
1 /*
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
2 * video_out_3dfx.c
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
3 * Heavily based on video_out_mga.c of Aaron Holtzman's mpeg2dec.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
5 * Copyright (C) Colin Cross Apr 2000
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
6 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
7 * This file is part of MPlayer.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
26739
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
9 * MPlayer is free software; you can redistribute it and/or modify
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
10 * it under the terms of the GNU General Public License as published by
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
12 * (at your option) any later version.
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
13 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
14 * MPlayer is distributed in the hope that it will be useful,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
17 * GNU General Public License for more details.
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
18 *
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
19 * You should have received a copy of the GNU General Public License along
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
20 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
2a34d9fa52ab Use standard license headers with standard formatting.
diego
parents: 25220
diff changeset
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <stdio.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include "config.h"
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
29 #include "mp_msg.h"
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
30 #include "help_mp.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31 #include "video_out.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 #include "video_out_internal.h"
24251
eabc7dc83a48 warning fix:
diego
parents: 23457
diff changeset
33 #include "x11_common.h"
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38 #include <sys/mman.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 #include <wchar.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 #include <signal.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 #include <X11/Xlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 #include <X11/extensions/xf86dga.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45 #include <X11/Xutil.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 //#define LOG(x) syslog(LOG_USER | LOG_DEBUG,x)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 #define LOG(x)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 #include "drivers/3dfx.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51
354
7de9e48c83a5 memcpy() moved mmx.h -> fastmemcpy.h
arpi_esp
parents: 350
diff changeset
52 #include "fastmemcpy.h"
350
601822cc8c52 applied MMX2 memcpy() patch by Nick Kurshev
arpi_esp
parents: 31
diff changeset
53
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
54 static const vo_info_t info =
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 "3dfx (/dev/3dfx)",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 "3dfx",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 "Colin Cross <colin@MIT.EDU>",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 ""
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61
25220
c9e9ac2008c2 Mark the vo_functions_t definitions as const where possible.
reimar
parents: 25216
diff changeset
62 const LIBVO_EXTERN(3dfx)
8148
5b39e79af5fe removed get_info, using the same sheme as in libmpcodecs instead
alex
parents: 7124
diff changeset
63
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 static uint32_t is_fullscreen = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 static uint32_t vidwidth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 static uint32_t vidheight;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 static uint32_t screenwidth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 static uint32_t screenheight;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 static uint32_t screendepth = 2; //Only 16bpp supported right now
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 static uint32_t dispwidth = 1280; // You can change these to whatever you want
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 static uint32_t dispheight = 720; // 16:9 screen ratio??
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 static uint32_t dispx;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 static uint32_t dispy;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 static uint32_t *vidpage0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 static uint32_t *vidpage1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 static uint32_t *vidpage2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 static uint32_t vidpage0offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 static uint32_t vidpage1offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 static uint32_t vidpage2offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 // Current pointer into framebuffer where display is located
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 static uint32_t targetoffset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 static uint32_t page_space;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 static voodoo_io_reg *reg_IO;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 static voodoo_2d_reg *reg_2d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 static voodoo_yuv_reg *reg_YUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 static voodoo_yuv_fb *fb_YUV;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 static uint32_t *memBase0, *memBase1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 static uint32_t baseAddr0, baseAddr1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 /* X11 related variables */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 static Display *display;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 static Window mywindow;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 static int bpp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 static XWindowAttributes attribs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105
17162
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
106 static int fd=-1;
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
107
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
109 static void
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
110 restore(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 //reg_IO->vidDesktopStartAddr = vidpage0offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 XF86DGADirectVideo(display,0,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
116 static void
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
117 sighup(int foo)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 //reg_IO->vidDesktopStartAddr = vidpage0offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 XF86DGADirectVideo(display,0,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 exit(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
124 static void
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
125 restore_regs(voodoo_2d_reg *regs)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 reg_2d->commandExtra = regs->commandExtra;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 reg_2d->clip0Min = regs->clip0Min;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 reg_2d->clip0Max = regs->clip0Max;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 reg_2d->srcBaseAddr = regs->srcBaseAddr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 reg_2d->srcXY = regs->srcXY;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 reg_2d->srcFormat = regs->srcFormat;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 reg_2d->srcSize = regs->srcSize;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136 reg_2d->dstBaseAddr = regs->dstBaseAddr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 reg_2d->dstXY = regs->dstXY;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 reg_2d->dstFormat = regs->dstFormat;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140 reg_2d->dstSize = regs->dstSize;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 reg_2d->command = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
144 static uint32_t
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
145 create_window(Display *display, char *title)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147 int screen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 unsigned int fg, bg;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 XSizeHints hint;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 XVisualInfo vinfo;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 XEvent xev;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 Colormap theCmap;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 XSetWindowAttributes xswa;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 unsigned long xswamask;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 screen = DefaultScreen(display);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 hint.x = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 hint.y = 10;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 hint.width = dispwidth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 hint.height = dispheight;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 hint.flags = PPosition | PSize;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 bg = WhitePixel(display, screen);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166 fg = BlackPixel(display, screen);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 XGetWindowAttributes(display, DefaultRootWindow(display), &attribs);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 bpp = attribs.depth;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
170 if (bpp != 16)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
172 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Only16BppSupported);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 exit(-1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 XMatchVisualInfo(display,screen,bpp,TrueColor,&vinfo);
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
177 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_3DFX_VisualIdIs,vinfo.visualid);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 theCmap = XCreateColormap(display, RootWindow(display,screen),
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 vinfo.visual, AllocNone);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 xswa.background_pixel = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 xswa.border_pixel = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 xswa.colormap = theCmap;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 xswamask = CWBackPixel | CWBorderPixel |CWColormap;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 mywindow = XCreateWindow(display, RootWindow(display,screen),
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 hint.x, hint.y, hint.width, hint.height, 4, bpp,CopyFromParent,vinfo.visual,xswamask,&xswa);
1137
4c7b219e126c patch: some X11 compliance fixed: set ClassHint and better fullscreen mode
arpi_esp
parents: 614
diff changeset
190 vo_x11_classhint( display,mywindow,"3dfx" );
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 XSelectInput(display, mywindow, StructureNotifyMask);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 /* Tell other applications about this window */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195
10994
fb0b7fe53645 micro cleanup
alex
parents: 8148
diff changeset
196 XSetStandardProperties(display, mywindow, title, title, None, NULL, 0, &hint);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 /* Map window. */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 XMapWindow(display, mywindow);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 /* Wait for map. */
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
203 do
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 XNextEvent(display, &xev);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 while (xev.type != MapNotify || xev.xmap.event != mywindow);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 XSelectInput(display, mywindow, NoEventMask);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211 XSync(display, False);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
216 static void
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
217 dump_yuv_planar(uint32_t *y, uint32_t *u, uint32_t *v, uint32_t to, uint32_t width, uint32_t height)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 // YUV conversion works like this:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 //
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 // We write the Y, U, and V planes separately into 3dfx YUV Planar memory
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 // region. The nice chip then takes these and packs them into the YUYV
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 // format in the regular frame buffer, starting at yuvBaseAddr, page 2 here.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
224 // Then we tell the 3dfx to do a Screen to Screen Stretch BLT to copy all
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 // of the data on page 2 onto page 1, converting it to 16 bpp RGB as it goes.
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
226 // The result is a nice image on page 1 ready for display.
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 uint32_t j;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 uint32_t y_imax, uv_imax, jmax;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 reg_YUV->yuvBaseAddr = to;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 reg_YUV->yuvStride = screenwidth*2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234 LOG("video_out_3dfx: starting planar dump\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235 jmax = height>>1; // vidheight/2, height of U and V planes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 y_imax = width; // Y plane is twice as wide as U and V planes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 uv_imax = width>>1; // vidwidth/2/4, width of U and V planes in 32-bit words
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
239 for (j=0;j<jmax;j++)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 //XXX this should be hand-rolled 32 bit memcpy for safeness.
23457
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 21977
diff changeset
242 fast_memcpy(fb_YUV->U + (uint32_t) VOODOO_YUV_STRIDE* j ,((uint8_t*) u) + uv_imax* j , uv_imax);
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 21977
diff changeset
243 fast_memcpy(fb_YUV->V + (uint32_t) VOODOO_YUV_STRIDE* j ,((uint8_t*) v) + uv_imax* j , uv_imax);
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 21977
diff changeset
244 fast_memcpy(fb_YUV->Y + (uint32_t) VOODOO_YUV_STRIDE* (j<<1) ,((uint8_t*) y) + y_imax * (j<<1) , y_imax);
a124f3abc1ec Replace implicit use of fast_memcpy via macro by explicit use to allow
reimar
parents: 21977
diff changeset
245 fast_memcpy(fb_YUV->Y + (uint32_t) VOODOO_YUV_STRIDE*((j<<1)+1),((uint8_t*) y) + y_imax *((j<<1)+1), y_imax);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 LOG("video_out_3dfx: done planar dump\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
250 static void
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
251 screen_to_screen_stretch_blt(uint32_t to, uint32_t from, uint32_t width, uint32_t height)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 //FIXME - this function should be called by a show_frame function that
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 // uses a series of blts to show only those areas not covered
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255 // by another window
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 voodoo_2d_reg saved_regs;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 LOG("video_out_3dfx: saving registers\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259 // Save VGA regs (so X kinda works when we're done)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 saved_regs = *reg_2d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262 /* The following lines set up the screen to screen stretch blt from page2 to
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 page 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 LOG("video_out_3dfx: setting blt registers\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267 reg_2d->commandExtra = 4; //disable colorkeying, enable wait for v-refresh (0100b)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268 reg_2d->clip0Min = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 reg_2d->clip0Max = 0xFFFFFFFF; //no clipping
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 reg_2d->srcBaseAddr = from;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272 reg_2d->srcXY = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 reg_2d->srcFormat = screenwidth*2 | VOODOO_BLT_FORMAT_YUYV; // | 1<<21;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 reg_2d->srcSize = vidwidth | (vidheight << 16);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 reg_2d->dstBaseAddr = to;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277 reg_2d->dstXY = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 reg_2d->dstFormat = screenwidth*2 | VOODOO_BLT_FORMAT_16;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 reg_2d->dstSize = width | (height << 16);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 LOG("video_out_3dfx: starting blt\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 // Executes screen to screen stretch blt
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 reg_2d->command = 2 | 1<<8 | 0xCC<<24;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 LOG("video_out_3dfx: restoring regs\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287 restore_regs(&saved_regs);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 LOG("video_out_3dfx: done blt\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
292 static void
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
293 update_target(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 uint32_t xp, yp, w, h, b, d;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 Window root;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298 XGetGeometry(display,mywindow,&root,&xp,&yp,&w,&h,&b,&d);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299 XTranslateCoordinates(display,mywindow,root,0,0,&xp,&yp,&root);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 dispx = (uint32_t) xp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 dispy = (uint32_t) yp;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 dispwidth = (uint32_t) w;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303 dispheight = (uint32_t) h;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
305 if (is_fullscreen)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 targetoffset = vidpage0offset + (screenheight - dispheight)/2*screenwidth*screendepth + (screenwidth-dispwidth)/2*screendepth;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
307 else
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 targetoffset = vidpage0offset + (dispy*screenwidth + dispx)*screendepth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
311 static int
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
312 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314 char *name = ":0.0";
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 pioData data;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 uint32_t retval;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317
17162
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
318 //TODO use x11_common for X and window handling
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
319
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 if(getenv("DISPLAY"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 name = getenv("DISPLAY");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 display = XOpenDisplay(name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 screenwidth = XDisplayWidth(display,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 screenheight = XDisplayHeight(display,0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 page_space = screenwidth*screenheight*screendepth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 vidpage0offset = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 vidpage1offset = page_space; // Use third and fourth pages
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 vidpage2offset = page_space*2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 signal(SIGALRM,sighup);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 //alarm(120);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 // Open driver device
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
336 if ( fd == -1 )
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
338 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_UnableToOpenDevice);
17160
ecdffaf7118c Do not exit() if /dev/3dfx is not available, approved by Ivan.
diego
parents: 16171
diff changeset
339 return -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 // Store sizes for later
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 vidwidth = width;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 vidheight = height;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 is_fullscreen = fullscreen = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
347 if (!is_fullscreen)
10994
fb0b7fe53645 micro cleanup
alex
parents: 8148
diff changeset
348 create_window(display, title);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 // Ask 3dfx driver for base memory address 0
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 data.port = 0x10; // PCI_BASE_ADDRESS_0_LINUX;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 data.size = 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 data.value = &baseAddr0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 data.device = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
355 if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
357 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Error,retval);
17162
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
358 return -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 // Ask 3dfx driver for base memory address 1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 data.port = 0x14; // PCI_BASE_ADDRESS_1_LINUX;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 data.size = 4;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 data.value = &baseAddr1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 data.device = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
366 if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
368 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Error,retval);
17162
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
369 return -1;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 // Map all 3dfx memory areas
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 memBase0 = mmap(0,0x1000000,PROT_READ | PROT_WRITE,MAP_SHARED,fd,baseAddr0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 memBase1 = mmap(0,3*page_space,PROT_READ | PROT_WRITE,MAP_SHARED,fd,baseAddr1);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
375 if (memBase0 == (uint32_t *) 0xFFFFFFFF || memBase1 == (uint32_t *) 0xFFFFFFFF)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
377 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_CouldntMapMemoryArea,
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 memBase0,memBase1,errno);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
379 }
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 // Set up global pointers
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 reg_IO = (void *)memBase0 + VOODOO_IO_REG_OFFSET;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 reg_2d = (void *)memBase0 + VOODOO_2D_REG_OFFSET;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 reg_YUV = (void *)memBase0 + VOODOO_YUV_REG_OFFSET;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 fb_YUV = (void *)memBase0 + VOODOO_YUV_PLANE_OFFSET;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 vidpage0 = (void *)memBase1 + (unsigned long int)vidpage0offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 vidpage1 = (void *)memBase1 + (unsigned long int)vidpage1offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 vidpage2 = (void *)memBase1 + (unsigned long int)vidpage2offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
391 // Clear pages 1,2,3
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 // leave page 0, that belongs to X.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393 // So does part of 1. Oops.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394 memset(vidpage1,0x00,page_space);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 memset(vidpage2,0x00,page_space);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
397 if (is_fullscreen)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 memset(vidpage0,0x00,page_space);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 #ifndef VOODOO_DEBUG
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 // Show page 0 (unblanked)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 reg_IO->vidDesktopStartAddr = vidpage0offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 /* Stop X from messing with my video registers!
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 Find a better way to do this?
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407 Currently I use DGA to tell XF86 to not screw with registers, but I can't really use it
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 to do FB stuff because I need to know the absolute FB position and offset FB position
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
409 to feed to BLT command
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 //XF86DGADirectVideo(display,0,XF86DGADirectGraphics); //| XF86DGADirectMouse | XF86DGADirectKeyb);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 #endif
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 atexit(restore);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
416 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_3DFX_DisplayInitialized,memBase1);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
420 static int
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
421 draw_frame(uint8_t *src[])
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 LOG("video_out_3dfx: starting display_frame\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425 // Put packed data onto page 2
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 dump_yuv_planar((uint32_t *)src[0],(uint32_t *)src[1],(uint32_t *)src[2],
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 vidpage2offset,vidwidth,vidheight);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 LOG("video_out_3dfx: done display_frame\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
433 static int
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
434 //draw_slice(uint8_t *src[], uint32_t slice_num)
1978
6e798c58d457 fixed to compile
arpi
parents: 1501
diff changeset
435 draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 uint32_t target;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438
1978
6e798c58d457 fixed to compile
arpi
parents: 1501
diff changeset
439 target = vidpage2offset + (screenwidth*2 * y);
6e798c58d457 fixed to compile
arpi
parents: 1501
diff changeset
440 dump_yuv_planar((uint32_t *)src[0],(uint32_t *)src[1],(uint32_t *)src[2],target,vidwidth,h);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1137
diff changeset
444 static void draw_osd(void)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1137
diff changeset
445 {
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1137
diff changeset
446 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1137
diff changeset
447
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
448 static void
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
449 flip_page(void)
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451 //FIXME - update_target() should be called by event handler when window
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452 // is resized or moved
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 update_target();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454 LOG("video_out_3dfx: calling blt function\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455 screen_to_screen_stretch_blt(targetoffset, vidpage2offset, dispwidth, dispheight);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 13056
diff changeset
458 static int
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 query_format(uint32_t format)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460 {
6207
1c5bde0ef5d1 revised query_format
alex
parents: 4737
diff changeset
461 /* does this supports scaling? up & down? */
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 switch(format){
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463 case IMGFMT_YV12:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464 // case IMGFMT_YUY2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 // case IMGFMT_RGB|24:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466 // case IMGFMT_BGR|24:
6207
1c5bde0ef5d1 revised query_format
alex
parents: 4737
diff changeset
467 return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW;
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 static void
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 uninit(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 {
17162
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
475 if( fd != -1 )
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
476 close(fd);
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
477 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
480 static void check_events(void)
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
481 {
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
482 }
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
483
16171
fd51fd1ff231 Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents: 13056
diff changeset
484 static int preinit(const char *arg)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1978
diff changeset
485 {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
486 if ( (fd = open("/dev/3dfx",O_RDWR) ) == -1)
17162
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
487 {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
488 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_UnableToOpenDevice);
17162
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
489 return -1;
e2b0daab849c move to next vo if /dev/3dfx could not be opened
iive
parents: 17160
diff changeset
490 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
491
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26739
diff changeset
492 if(arg)
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
493 {
18234
a107276371a8 Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents: 17162
diff changeset
494 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_UnknownSubdevice,arg);
4737
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
495 return ENOSYS;
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
496 }
32e1f5042f65 I don't like such reports: '-vo dga:vidix or -vo x11:vidix works fine for me'
nick
parents: 4596
diff changeset
497 return 0;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1978
diff changeset
498 }
31
1fc618eba830 added check_events() interface
arpi_esp
parents: 1
diff changeset
499
33305
ddb45e9443ec Remove the variable arguments from the libvo control() functions.
iive
parents: 29263
diff changeset
500 static int control(uint32_t request, void *data)
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1978
diff changeset
501 {
4592
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
502 switch (request) {
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
503 case VOCTRL_QUERY_FORMAT:
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
504 return query_format(*((uint32_t*)data));
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
505 }
5fbfd8545c3b query_ stuff replaced by new control() - patch by David Holm
arpi
parents: 4433
diff changeset
506 return VO_NOTIMPL;
4352
ed5b85b713a3 Extensions for video accelerated architecture
nick
parents: 1978
diff changeset
507 }