annotate libvo/vo_tdfx_vid.c @ 9546:8feb4bb5b334

vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
author albeu
date Fri, 07 Mar 2003 18:45:02 +0000
parents
children 9883afd390dc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9546
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
1 /*
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
2 * video_out_null.c
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
3 *
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
4 * Copyright (C) Aaron Holtzman - June 2000
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
5 *
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
6 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
7 *
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
8 * mpeg2dec is free software; you can redistribute it and/or modify
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
10 * the Free Software Foundation; either version 2, or (at your option)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
11 * any later version.
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
12 *
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
13 * mpeg2dec is distributed in the hope that it will be useful,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
16 * GNU General Public License for more details.
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
17 *
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
19 * along with GNU Make; see the file COPYING. If not, write to
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
20 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
21 *
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
22 */
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
23
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
24 #include <stdio.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
25 #include <stdlib.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
26 #include <string.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
27 #include <errno.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
28 #include <sys/types.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
29 #include <sys/stat.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
30 #include <fcntl.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
31 #include <unistd.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
32 #include <sys/ioctl.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
33 #include <sys/mman.h>
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
34 #include "config.h"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
35 #include "video_out.h"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
36 #include "video_out_internal.h"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
37 #include "aspect.h"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
38
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
39 #include "fastmemcpy.h"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
40 #include "drivers/tdfx_vid.h"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
41
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
42
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
43 static vo_info_t info =
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
44 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
45 "tdfx_vid video output",
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
46 "tdfx_vid",
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
47 "Albeu",
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
48 ""
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
49 };
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
50
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
51 LIBVO_EXTERN(tdfx_vid)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
52
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
53 static tdfx_vid_config_t tdfx_cfg;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
54
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
55 static unsigned char* agp_mem = NULL;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
56 static int tdfx_fd = -1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
57
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
58 static uint32_t img_fmt; // The real input format
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
59 static uint32_t src_width, src_height, src_fmt, src_bpp, src_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
60 static uint32_t dst_width, dst_height, dst_fmt, dst_bpp, dst_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
61
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
62 static uint32_t tdfx_page;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
63 static uint32_t front_buffer;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
64 static uint32_t back_buffer;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
65
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
66
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
67 static uint32_t draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
68 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
69 tdfx_vid_agp_move_t mov;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
70 tdfx_vid_yuv_t yuv;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
71 int p;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
72 uint8_t* ptr[3];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
73
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
74 switch(img_fmt) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
75 case IMGFMT_YUY2:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
76 case IMGFMT_UYVY:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
77 case IMGFMT_BGR8:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
78 case IMGFMT_BGR16:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
79 case IMGFMT_BGR24:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
80 case IMGFMT_BGR32:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
81 // copy :( to agp_mem
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
82 // still faster than tdfxfb wich directly copy to the video mem :)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
83 memcpy_pic(agp_mem,image[0],src_bpp*w,h,stride[0],stride[0]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
84
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
85 mov.move2 = TDFX_VID_MOVE_2_PACKED;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
86 mov.width = w*src_bpp;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
87 mov.height = h;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
88 mov.src = 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
89 mov.src_stride = stride[0];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
90
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
91 mov.dst = back_buffer + y*src_stride + x * src_bpp;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
92 mov.dst_stride = src_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
93
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
94 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
95 printf("tdfx_vid: AGP move failed\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
96 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
97 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
98 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
99 case IMGFMT_YV12:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
100 case IMGFMT_I420:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
101 // Copy to agp mem
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
102 ptr[0] = agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
103 memcpy_pic(ptr[0],image[0],w,h,stride[0],stride[0]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
104 ptr[1] = ptr[0] + (h*stride[0]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
105 memcpy_pic(ptr[1],image[1],w/2,h/2,stride[1],stride[1]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
106 ptr[2] = ptr[1] + (h/2*stride[1]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
107 memcpy_pic(ptr[2],image[2],w/2,h/2,stride[2],stride[2]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
108
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
109 // Setup the yuv thing
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
110 yuv.base = back_buffer + y*src_stride + x * src_bpp;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
111 yuv.stride = src_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
112 if(ioctl(tdfx_fd,TDFX_VID_SET_YUV,&yuv)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
113 printf("tdfx_vid: Set yuv failed\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
114 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
115 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
116
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
117 // Now agp move that
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
118 // Y
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
119 mov.move2 = TDFX_VID_MOVE_2_YUV;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
120 mov.width = w;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
121 mov.height = h;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
122 mov.src = ptr[0] - agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
123 mov.src_stride = stride[0];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
124 mov.dst = 0x0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
125 mov.dst_stride = TDFX_VID_YUV_STRIDE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
126 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
127 printf("tdfx_vid: AGP move failed on Y plane\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
128 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
129 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
130 //return 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
131 // U
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
132 p = img_fmt == IMGFMT_YV12 ? 1 : 2;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
133 mov.width = w/2;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
134 mov.height = h/2;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
135 mov.src = ptr[p] - agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
136 mov.src_stride = stride[p];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
137 mov.dst += TDFX_VID_YUV_PLANE_SIZE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
138 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
139 printf("tdfx_vid: AGP move failed on U plane\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
140 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
141 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
142 // V
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
143 p = img_fmt == IMGFMT_YV12 ? 2 : 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
144 mov.src = ptr[p] - agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
145 mov.src_stride = stride[p];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
146 mov.dst += TDFX_VID_YUV_PLANE_SIZE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
147 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
148 printf("tdfx_vid: AGP move failed on U plane\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
149 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
150 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
151 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
152
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
153 return 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
154 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
155
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
156 static void draw_osd(void)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
157 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
158 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
159
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
160 static void
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
161 flip_page(void)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
162 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
163 tdfx_vid_blit_t blit;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
164 //return;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
165 // Scale convert
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
166 blit.src = back_buffer;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
167 blit.src_stride = src_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
168 blit.src_x = 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
169 blit.src_y = 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
170 blit.src_w = src_width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
171 blit.src_h = src_height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
172 blit.src_format = src_fmt;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
173
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
174 blit.dst = front_buffer;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
175 blit.dst_stride = dst_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
176 blit.dst_x = 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
177 blit.dst_y = 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
178 blit.dst_w = dst_width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
179 blit.dst_h = dst_height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
180 blit.dst_format = dst_fmt;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
181
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
182 if(ioctl(tdfx_fd,TDFX_VID_BLIT,&blit))
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
183 printf("tdfx_vid: Blit failed\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
184 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
185
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
186 static uint32_t
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
187 draw_frame(uint8_t *src[])
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
188 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
189 int stride[] = { src_stride, 0, 0};
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
190 return draw_slice(src,stride,src_width, src_height,0,0);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
191 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
192
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
193 static uint32_t
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
194 query_format(uint32_t format)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
195 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
196 switch(format) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
197 case IMGFMT_YUY2:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
198 case IMGFMT_UYVY:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
199 case IMGFMT_BGR8:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
200 case IMGFMT_BGR16:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
201 case IMGFMT_BGR24:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
202 case IMGFMT_BGR32:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
203 case IMGFMT_YV12:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
204 case IMGFMT_I420:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
205 return 3 | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
206 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
207 return 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
208 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
209
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
210 static uint32_t
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
211 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, uint32_t format)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
212 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
213
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
214 if(tdfx_fd < 0)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
215 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
216
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
217 if(!vo_screenwidth)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
218 vo_screenwidth = tdfx_cfg.screen_width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
219 if(!vo_screenheight)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
220 vo_screenheight = tdfx_cfg.screen_height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
221
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
222 aspect_save_orig(width,height);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
223 aspect_save_prescale(d_width,d_height);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
224 aspect_save_screenres(vo_screenwidth,vo_screenheight);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
225
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
226 if(fullscreen&0x01) { /* -fs */
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
227 aspect(&d_width,&d_height,A_ZOOM);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
228 vo_fs = VO_TRUE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
229 } else {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
230 aspect(&d_width,&d_height,A_NOZOOM);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
231 vo_fs = VO_FALSE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
232 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
233
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
234 src_width = width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
235 src_height = height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
236 switch(format) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
237 case IMGFMT_BGR8:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
238 case IMGFMT_BGR16:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
239 case IMGFMT_BGR24:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
240 case IMGFMT_BGR32:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
241 src_fmt = format;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
242 src_bpp = ((format & 0x3F)+7)/8;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
243 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
244 case IMGFMT_YUY2:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
245 case IMGFMT_YV12:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
246 case IMGFMT_I420:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
247 src_fmt = TDFX_VID_FORMAT_YUY2;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
248 src_bpp = 2;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
249 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
250 default:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
251 printf("Unsupported input format 0x%x\n",format);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
252 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
253 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
254
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
255 img_fmt = format;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
256 src_stride = src_width*src_bpp;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
257
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
258 dst_fmt = tdfx_cfg.screen_format;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
259 dst_bpp = ((dst_fmt & 0x3F)+7)/8;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
260 dst_width = d_width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
261 dst_height = d_height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
262 dst_stride = tdfx_cfg.screen_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
263
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
264 tdfx_page = tdfx_cfg.screen_stride*tdfx_cfg.screen_height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
265 front_buffer = tdfx_cfg.screen_start;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
266 back_buffer = front_buffer + tdfx_page;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
267
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
268 printf("tdfxvid setup : %d(%d) x %d @ %d => %d(%d) x %d @ %d\n",
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
269 src_width,src_stride,src_height,src_bpp,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
270 dst_width,dst_stride,dst_height,dst_bpp);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
271
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
272 return 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
273 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
274
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
275 static void
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
276 uninit(void)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
277 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
278 close(tdfx_fd);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
279 tdfx_fd = -1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
280 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
281
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
282
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
283 static void check_events(void)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
284 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
285 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
286
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
287 static uint32_t preinit(const char *arg)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
288 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
289
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
290 tdfx_fd = open(arg ? arg : "/dev/tdfx_vid", O_RDWR);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
291 if(tdfx_fd < 0) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
292 printf("tdfx_vid: Can't open %s: %s\n",arg ? arg : "/dev/tdfx_vid",
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
293 strerror(errno));
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
294 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
295 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
296
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
297 if(ioctl(tdfx_fd,TDFX_VID_GET_CONFIG,&tdfx_cfg)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
298 printf("tdfx_vid: Can't get current cfg: %s\n",strerror(errno));
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
299 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
300 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
301
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
302 printf("tdfx_vid version %d\n"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
303 " Ram: %d\n"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
304 " Screen: %d x %d\n"
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
305 " Format: %c%c%c%d\n",
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
306 tdfx_cfg.version,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
307 tdfx_cfg.ram_size,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
308 tdfx_cfg.screen_width, tdfx_cfg.screen_height,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
309 tdfx_cfg.screen_format>>24,(tdfx_cfg.screen_format>>16)&0xFF,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
310 (tdfx_cfg.screen_format>>8)&0xFF,tdfx_cfg.screen_format&0xFF);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
311
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
312 // For now just allocate more than i ever need
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
313 agp_mem = mmap( NULL, 1024*768*4, PROT_READ | PROT_WRITE, MAP_SHARED,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
314 tdfx_fd, 0);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
315
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
316 if(agp_mem == MAP_FAILED) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
317 printf("tdfx_vid: Memmap failed !!!!!\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
318 return 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
319 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
320
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
321 memset(agp_mem,0,1024*768*4);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
322
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
323 return 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
324 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
325
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
326 static uint32_t get_image(mp_image_t *mpi) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
327
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
328 if(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
329 mpi->flags &= ~MP_IMGFLAG_DRAW_CALLBACK;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
330
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
331 if(mpi->type > MP_IMGTYPE_TEMP)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
332 return VO_FALSE; // TODO ??
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
333
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
334 switch(mpi->imgfmt) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
335 case IMGFMT_YUY2:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
336 case IMGFMT_UYVY:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
337 // case IMGFMT_BGR8:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
338 case IMGFMT_BGR16:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
339 case IMGFMT_BGR24:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
340 case IMGFMT_BGR32:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
341 mpi->planes[0] = agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
342 mpi->stride[0] = src_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
343 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
344 case IMGFMT_YV12:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
345 mpi->planes[0] = agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
346 mpi->stride[0] = mpi->width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
347 mpi->planes[1] = mpi->planes[0] + mpi->stride[0]*mpi->height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
348 mpi->stride[1] = mpi->chroma_width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
349 mpi->planes[2] = mpi->planes[1] + mpi->stride[1]*mpi->chroma_height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
350 mpi->stride[2] = mpi->chroma_width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
351 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
352 default:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
353 printf("Get image todo\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
354 return VO_FALSE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
355 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
356 mpi->flags |= MP_IMGFLAG_DIRECT;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
357
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
358 return VO_TRUE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
359 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
360
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
361 static uint32_t draw_image(mp_image_t *mpi){
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
362 tdfx_vid_agp_move_t mov;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
363 tdfx_vid_yuv_t yuv;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
364 int p;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
365 uint8_t* planes[3];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
366 int stride[3];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
367
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
368 //printf("Draw image !!!!\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
369 if(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
370 return VO_TRUE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
371
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
372 switch(mpi->imgfmt) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
373 case IMGFMT_YUY2:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
374 case IMGFMT_UYVY:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
375 case IMGFMT_BGR8:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
376 case IMGFMT_BGR16:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
377 case IMGFMT_BGR24:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
378 case IMGFMT_BGR32:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
379 if(!(mpi->flags&MP_IMGFLAG_DIRECT)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
380 // copy :( to agp_mem
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
381 // still faster than tdfxfb wich directly copy to the video mem :)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
382 planes[0] = agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
383 memcpy_pic(agp_mem,mpi->planes[0],src_bpp*mpi->width,mpi->height,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
384 mpi->stride[0],mpi->stride[0]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
385 } else
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
386 planes[0] = mpi->planes[0];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
387
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
388 mov.move2 = TDFX_VID_MOVE_2_PACKED;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
389 mov.width = mpi->width*((mpi->bpp+7)/8);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
390 mov.height = mpi->height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
391 mov.src = planes[0] - agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
392 mov.src_stride = mpi->stride[0];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
393
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
394 mov.dst = back_buffer;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
395 mov.dst_stride = src_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
396
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
397 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov))
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
398 printf("tdfx_vid: AGP move failed\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
399 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
400
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
401 case IMGFMT_YV12:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
402 case IMGFMT_I420:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
403 if(!(mpi->flags&MP_IMGFLAG_DIRECT)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
404 // Copy to agp mem
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
405 planes[0] = agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
406 memcpy_pic(planes[0],mpi->planes[0],mpi->width,mpi->height,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
407 mpi->stride[0],mpi->stride[0]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
408 planes[1] = planes[0] + (mpi->height*mpi->stride[0]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
409 memcpy_pic(planes[1],mpi->planes[1],mpi->chroma_width,mpi->chroma_height,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
410 mpi->stride[1],mpi->stride[1]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
411 planes[2] = planes[1] + (mpi->chroma_height*mpi->stride[1]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
412 memcpy_pic(planes[2],mpi->planes[2],mpi->chroma_width,mpi->chroma_height,
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
413 mpi->stride[2],mpi->stride[2]);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
414 } else
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
415 memcpy(planes,mpi->planes,3*sizeof(uint8_t*));
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
416
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
417 // Setup the yuv thing
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
418 yuv.base = back_buffer;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
419 yuv.stride = src_stride;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
420 if(ioctl(tdfx_fd,TDFX_VID_SET_YUV,&yuv)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
421 printf("tdfx_vid: Set yuv failed\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
422 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
423 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
424 //return VO_FALSE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
425 // Now agp move that
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
426 // Y
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
427 mov.move2 = TDFX_VID_MOVE_2_YUV;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
428 mov.width = mpi->width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
429 mov.height = mpi->height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
430 mov.src = planes[0] - agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
431 mov.src_stride = mpi->stride[0];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
432 mov.dst = 0x0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
433 mov.dst_stride = TDFX_VID_YUV_STRIDE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
434
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
435 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
436 printf("tdfx_vid: AGP move failed on Y plane\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
437 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
438 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
439 //return 0;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
440 // U
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
441 p = mpi->imgfmt == IMGFMT_YV12 ? 1 : 2;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
442 mov.width = mpi->chroma_width;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
443 mov.height = mpi->chroma_height;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
444 mov.src = planes[p] - agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
445 mov.src_stride = mpi->stride[p];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
446 mov.dst += TDFX_VID_YUV_PLANE_SIZE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
447 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
448 printf("tdfx_vid: AGP move failed on U plane\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
449 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
450 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
451 // V
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
452 p = mpi->imgfmt == IMGFMT_YV12 ? 2 : 1;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
453 mov.src = planes[p] - agp_mem;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
454 mov.src_stride = mpi->stride[p];
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
455 mov.dst += TDFX_VID_YUV_PLANE_SIZE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
456 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
457 printf("tdfx_vid: AGP move failed on U plane\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
458 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
459 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
460 break;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
461 default:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
462 printf("What's that for a format 0x%x\n",mpi->imgfmt);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
463 return VO_TRUE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
464 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
465 printf("Draw image true !!!!!\n");
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
466 return VO_TRUE;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
467 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
468
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
469
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
470 static uint32_t control(uint32_t request, void *data, ...)
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
471 {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
472 switch (request) {
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
473 case VOCTRL_QUERY_FORMAT:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
474 return query_format(*((uint32_t*)data));
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
475 case VOCTRL_GET_IMAGE:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
476 return get_image(data);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
477 case VOCTRL_DRAW_IMAGE:
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
478 return draw_image(data);
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
479 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
480 return VO_NOTIMPL;
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
481 }
8feb4bb5b334 vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff changeset
482