Mercurial > mplayer.hg
annotate libvo/vo_tdfx_vid.c @ 24990:fd919e77c834
Support mute when passthrough to digital output.
author | ulion |
---|---|
date | Sun, 11 Nov 2007 02:54:57 +0000 |
parents | 94ec445120da |
children | 3aee342be929 |
rev | line source |
---|---|
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
1 /* |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
2 * vo_tdfx_vid.c |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
3 * |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
4 * Copyright (C) Alban Bedel - 03/2003 |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
5 * |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
6 * This file is part of MPlayer, a free movie player. |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
7 * |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
9546
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 * |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
9546
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 * |
21977
cea0eb833758
Fix FSF address and otherwise broken license headers.
diego
parents:
18335
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
cea0eb833758
Fix FSF address and otherwise broken license headers.
diego
parents:
18335
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
cea0eb833758
Fix FSF address and otherwise broken license headers.
diego
parents:
18335
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
9546
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 #include <stdio.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
24 #include <stdlib.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
25 #include <string.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
26 #include <errno.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
27 #include <sys/types.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
28 #include <sys/stat.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
29 #include <fcntl.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
30 #include <unistd.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
31 #include <sys/ioctl.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
32 #include <sys/mman.h> |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
33 #include "config.h" |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
34 #include "video_out.h" |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
35 #include "video_out_internal.h" |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
36 #include "aspect.h" |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
37 #include "mp_msg.h" |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
38 #include "help_mp.h" |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
39 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
40 #include "fastmemcpy.h" |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
41 #include "drivers/tdfx_vid.h" |
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 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
44 static vo_info_t info = |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
45 { |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
46 "tdfx vid", |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
47 "tdfx_vid", |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
48 "Albeu", |
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 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
52 //#define VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
53 |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
54 LIBVO_EXTERN(tdfx_vid) |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
55 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
56 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
|
57 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
58 static unsigned char* agp_mem = NULL; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
59 static int tdfx_fd = -1; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
60 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
61 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
|
62 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
|
63 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
|
64 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
65 static uint32_t tdfx_page; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
66 static uint32_t front_buffer; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
67 static uint32_t back_buffer; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
68 static uint8_t num_buffer = 3; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
69 static uint32_t buffer_size; // Max size |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
70 static uint8_t current_buffer = 0; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
71 static uint8_t current_ip_buf = 0; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
72 static uint32_t buffer_stride[3]; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
73 |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
74 static int use_overlay = 1; |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
75 static tdfx_vid_overlay_t tdfx_ov; |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
76 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
77 // FIXME |
24862
94ec445120da
Disable clear_screen function, the call to the function is commented out
diego
parents:
24252
diff
changeset
|
78 #if 0 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
79 static void clear_screen(void) { |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
80 tdfx_vid_agp_move_t mov; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
81 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
82 memset(agp_mem,0,tdfx_cfg.screen_width*dst_bpp*tdfx_cfg.screen_height); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
83 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
84 mov.move2 = TDFX_VID_MOVE_2_PACKED; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
85 mov.width = tdfx_cfg.screen_width*dst_bpp; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
86 mov.height = tdfx_cfg.screen_height; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
87 mov.src = 0; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
88 mov.src_stride = tdfx_cfg.screen_width*dst_bpp; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
89 mov.dst = front_buffer; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
90 mov.dst_stride = tdfx_cfg.screen_stride; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
91 |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
92 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_Move, mov.width,mov.src_stride,mov.height,mov.dst_stride); |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
93 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
94 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
95 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AGPMoveFailedToClearTheScreen); |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
96 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
97 } |
24862
94ec445120da
Disable clear_screen function, the call to the function is commented out
diego
parents:
24252
diff
changeset
|
98 #endif |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
99 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
100 static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
101 { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
102 uint8_t* ptr[3]; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
103 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
104 #ifdef VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
105 printf("Draw slices %d\n",current_buffer); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
106 #endif |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
107 switch(img_fmt) { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
108 case IMGFMT_YUY2: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
109 case IMGFMT_UYVY: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
110 case IMGFMT_BGR8: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
111 case IMGFMT_BGR16: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
112 case IMGFMT_BGR24: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
113 case IMGFMT_BGR32: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
114 // copy :( to agp_mem |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
115 // still faster than tdfxfb wich directly copy to the video mem :) |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
116 mem2agpcpy_pic(agp_mem + current_buffer * buffer_size + |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
117 y*buffer_stride[0] + x * src_bpp, |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
118 image[0], |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
119 src_bpp*w,h,buffer_stride[0],stride[0]); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
120 return 0; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
121 |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
122 case IMGFMT_YV12: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
123 case IMGFMT_I420: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
124 // Copy to agp mem |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
125 ptr[0] = agp_mem + current_buffer * buffer_size; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
126 mem2agpcpy_pic(ptr[0] + y * buffer_stride[0] + x,image[0],w,h, |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
127 buffer_stride[0],stride[0]); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
128 ptr[1] = ptr[0] + (src_height*src_width); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
129 mem2agpcpy_pic(ptr[1] + y/2 * buffer_stride[1] + x/2,image[1],w/2,h/2, |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
130 buffer_stride[1],stride[1]); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
131 ptr[2] = ptr[1] + (src_height*src_width/4); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
132 mem2agpcpy_pic(ptr[2] + y/2 * buffer_stride[2] + x/2,image[2],w/2,h/2, |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
133 buffer_stride[2],stride[2]); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
134 return 0; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
135 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
136 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
137 return 1; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
138 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
139 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
140 static void draw_osd(void) |
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 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
143 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
144 static void |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
145 flip_page(void) |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
146 { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
147 tdfx_vid_blit_t blit; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
148 //return; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
149 // Scale convert |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
150 #ifdef VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
151 printf("Flip\n"); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
152 #endif |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
153 if(use_overlay) { |
23873 | 154 // TDFX_VID_OVERLAY_ON does nothing if the overlay is already on |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
155 if(!ioctl(tdfx_fd,TDFX_VID_OVERLAY_ON)) { // X11 killed the overlay :( |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
156 if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&tdfx_ov)) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
157 mp_msg(MSGT_VO, MSGL_ERR, "tdfx_vid: set_overlay failed\n"); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
158 } |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
159 // These formats need conversion |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
160 switch(src_fmt) { |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
161 case IMGFMT_BGR8: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
162 case IMGFMT_BGR24: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
163 case IMGFMT_BGR32: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
164 memset(&blit,0,sizeof(tdfx_vid_blit_t)); |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
165 blit.src = back_buffer; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
166 blit.src_stride = src_stride; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
167 blit.src_x = 0; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
168 blit.src_y = 0; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
169 blit.src_w = src_width; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
170 blit.src_h = src_height; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
171 blit.src_format = src_fmt; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
172 |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
173 blit.dst = front_buffer; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
174 blit.dst_stride = dst_stride; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
175 blit.dst_x = 0; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
176 blit.dst_y = 0; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
177 blit.dst_w = src_width; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
178 blit.dst_h = src_height; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
179 blit.dst_format = IMGFMT_BGR16; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
180 if(ioctl(tdfx_fd,TDFX_VID_BLIT,&blit)) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
181 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_BlitFailed); |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
182 } |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
183 return; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
184 } |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
185 memset(&blit,0,sizeof(tdfx_vid_blit_t)); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
186 blit.src = back_buffer; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
187 blit.src_stride = src_stride; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
188 blit.src_x = 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
189 blit.src_y = 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
190 blit.src_w = src_width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
191 blit.src_h = src_height; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
192 blit.src_format = src_fmt; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
193 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
194 blit.dst = front_buffer; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
195 blit.dst_stride = dst_stride; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
196 blit.dst_x = 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
197 blit.dst_y = 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
198 blit.dst_w = dst_width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
199 blit.dst_h = dst_height; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
200 blit.dst_format = dst_fmt; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
201 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
202 if(ioctl(tdfx_fd,TDFX_VID_BLIT,&blit)) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
203 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_BlitFailed); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
204 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
205 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
206 static int |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
207 draw_frame(uint8_t *src[]) |
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 int stride[] = { src_stride, 0, 0}; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
210 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
|
211 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
212 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
213 static int |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
214 query_format(uint32_t format) |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
215 { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
216 switch(format) { |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
217 case IMGFMT_BGR8: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
218 if(tdfx_cfg.screen_format == TDFX_VID_FORMAT_BGR8) |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
9569
diff
changeset
|
219 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
220 return 0; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
221 case IMGFMT_YUY2: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
222 case IMGFMT_UYVY: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
223 case IMGFMT_BGR15: |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
224 case IMGFMT_BGR16: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
225 case IMGFMT_BGR24: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
226 case IMGFMT_BGR32: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
227 case IMGFMT_YV12: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
228 case IMGFMT_I420: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
229 if(tdfx_cfg.screen_format == TDFX_VID_FORMAT_BGR8) |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
230 return 0; |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
9569
diff
changeset
|
231 return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_ACCEPT_STRIDE; |
9546
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 return 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
234 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
235 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
236 static int |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
9569
diff
changeset
|
237 config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
238 { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
239 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
240 if(tdfx_fd < 0) |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
241 return 1; |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
242 // When we are run as sub vo we must follow the size gaven to us |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
9569
diff
changeset
|
243 if(!(flags & VOFLAG_XOVERLAY_SUB_VO)) { |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
244 if(!vo_screenwidth) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
245 vo_screenwidth = tdfx_cfg.screen_width; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
246 if(!vo_screenheight) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
247 vo_screenheight = tdfx_cfg.screen_height; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
248 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
249 aspect_save_orig(width,height); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
250 aspect_save_prescale(d_width,d_height); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
251 aspect_save_screenres(vo_screenwidth,vo_screenheight); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
252 |
15212
05aa13cdf92f
replace VO and VF numeric flags with #defined identifiers
henry
parents:
9569
diff
changeset
|
253 if(flags&VOFLAG_FULLSCREEN) { /* -fs */ |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
254 aspect(&d_width,&d_height,A_ZOOM); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
255 vo_fs = VO_TRUE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
256 } else { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
257 aspect(&d_width,&d_height,A_NOZOOM); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
258 vo_fs = VO_FALSE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
259 } |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
260 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
261 src_width = width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
262 src_height = height; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
263 buffer_size = 0; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
264 buffer_stride[0] = 0; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
265 src_fmt = 0; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
266 switch(format) { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
267 case IMGFMT_BGR8: |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
268 case IMGFMT_BGR24: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
269 case IMGFMT_BGR32: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
270 if(use_overlay) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
271 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_NonNativeOverlayFormatNeedConversion); |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
272 case IMGFMT_BGR15: |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
273 case IMGFMT_BGR16: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
274 src_bpp = ((format & 0x3F)+7)/8; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
275 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
276 case IMGFMT_YV12: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
277 case IMGFMT_I420: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
278 buffer_size = src_width * src_height * 3 / 2; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
279 buffer_stride[0] = ((src_width+1)/2)*2; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
280 buffer_stride[1] = buffer_stride[2] = buffer_stride[0]/2; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
281 src_fmt = TDFX_VID_FORMAT_YUY2; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
282 case IMGFMT_YUY2: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
283 case IMGFMT_UYVY: |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
284 src_bpp = 2; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
285 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
286 default: |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
287 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_UnsupportedInputFormat,format); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
288 return 1; |
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 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
291 img_fmt = format; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
292 src_stride = src_width*src_bpp; |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
293 // The overlay need a 4 bytes aligned stride |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
294 if(use_overlay) |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
295 src_stride = ((src_stride+3)/4)*4; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
296 if(!src_fmt) |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
297 src_fmt = format; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
298 if(!buffer_size) |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
299 buffer_size = src_stride*src_height; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
300 if(!buffer_stride[0]) |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
301 buffer_stride[0] = src_stride; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
302 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
303 dst_fmt = tdfx_cfg.screen_format; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
304 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
|
305 dst_width = d_width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
306 dst_height = d_height; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
307 dst_stride = tdfx_cfg.screen_stride; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
308 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
309 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
|
310 front_buffer = tdfx_cfg.screen_start; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
311 back_buffer = front_buffer + tdfx_page; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
312 |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
313 while(use_overlay) { |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
314 tdfx_vid_overlay_t ov; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
315 uint32_t ov_fmt = src_fmt, ov_stride = src_stride; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
316 // Align the buffer |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
317 back_buffer = (((back_buffer+3)/4)*4); |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
318 // With the overlay the front buffer is not on the screen |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
319 // so we take the back buffer |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
320 front_buffer = back_buffer; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
321 switch(src_fmt) { |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
322 case IMGFMT_BGR8: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
323 case IMGFMT_BGR24: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
324 case IMGFMT_BGR32: |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
325 back_buffer = front_buffer + 2*(src_stride*src_height); |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
326 ov_stride = dst_stride = src_width<<1; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
327 ov_fmt = IMGFMT_BGR16; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
328 break; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
329 } |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
330 ov.src[0] = front_buffer; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
331 ov.src[1] = front_buffer + (src_stride*src_height); |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
332 ov.src_width = src_width; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
333 ov.src_height = src_height; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
334 ov.src_stride = ov_stride; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
335 ov.format = ov_fmt; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
336 ov.dst_width = dst_width; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
337 ov.dst_height = dst_height; |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
338 ov.dst_x = vo_dx; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
339 ov.dst_y = vo_dy; |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
340 ov.use_colorkey = 0; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
341 |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
342 if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&ov)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
343 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_OverlaySetupFailed); |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
344 use_overlay = 0; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
345 break; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
346 } |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
347 tdfx_ov = ov; |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
348 if(use_overlay == 1) { |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
349 if(ioctl(tdfx_fd,TDFX_VID_OVERLAY_ON)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
350 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_OverlayOnFailed); |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
351 use_overlay = 0; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
352 break; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
353 } |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
354 use_overlay++; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
355 } |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
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:
16171
diff
changeset
|
357 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_OverlayReady, |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
358 src_width,src_stride,src_height,src_bpp, |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
359 dst_width,dst_stride,dst_height,dst_bpp); |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
360 break; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
361 } |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
362 |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
363 if(!use_overlay) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
364 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_TextureBlitReady, |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
365 src_width,src_stride,src_height,src_bpp, |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
366 dst_width,dst_stride,dst_height,dst_bpp); |
9546
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 return 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
369 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
370 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
371 static void |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
372 uninit(void) |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
373 { |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
374 if(use_overlay == 2) { |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
375 if(ioctl(tdfx_fd,TDFX_VID_OVERLAY_OFF)) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
376 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_OverlayOffFailed); |
9567
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
377 use_overlay--; |
0c9c02cfe815
Support for the overlay, that save one stretch blit for bgr16 and YUV formats
albeu
parents:
9559
diff
changeset
|
378 } |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
379 close(tdfx_fd); |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
380 tdfx_fd = -1; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
381 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
382 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
383 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
384 static void check_events(void) |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
385 { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
386 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
387 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
388 static int preinit(const char *arg) |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
389 { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
390 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
391 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
|
392 if(tdfx_fd < 0) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
393 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_CantOpen,arg ? arg : "/dev/tdfx_vid", |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
394 strerror(errno)); |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
395 return 1; |
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 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
398 if(ioctl(tdfx_fd,TDFX_VID_GET_CONFIG,&tdfx_cfg)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
399 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_CantGetCurrentCfg,strerror(errno)); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
400 return 1; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
401 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
402 |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
403 mp_msg(MSGT_VO,MSGL_INFO, "tdfx_vid version %d\n" |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
404 " Ram: %d\n" |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
405 " Screen: %d x %d\n" |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
406 " Format: %c%c%c%d\n", |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
407 tdfx_cfg.version, |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
408 tdfx_cfg.ram_size, |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
409 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
|
410 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
|
411 (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
|
412 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
413 // 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
|
414 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
|
415 tdfx_fd, 0); |
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 if(agp_mem == MAP_FAILED) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
418 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_MemmapFailed); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
419 return 1; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
420 } |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
421 |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
422 memset(agp_mem,0,1024*768*4); |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
423 |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
424 return 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
425 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
426 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
427 static uint32_t get_image(mp_image_t *mpi) { |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
428 int buf = 0; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
429 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
430 #ifdef VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
431 printf("Get image %d\n",buf); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
432 #endif |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
433 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
434 // Currently read are too slow bcs we read from the |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
435 // agp aperture and not the memory directly |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
436 //if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
437 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
438 if(mpi->flags&MP_IMGFLAG_READABLE && |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
439 (mpi->type==MP_IMGTYPE_IPB || mpi->type==MP_IMGTYPE_IP)){ |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
440 // reference (I/P) frame of IP or IPB: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
441 if(num_buffer<2) return VO_FALSE; // not enough |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
442 current_ip_buf^=1; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
443 // for IPB with 2 buffers we can DR only one of the 2 P frames: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
444 if(mpi->type==MP_IMGTYPE_IPB && num_buffer<3 && current_ip_buf) return VO_FALSE; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
445 buf=current_ip_buf; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
446 if(mpi->type==MP_IMGTYPE_IPB) ++buf; // preserve space for B |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
447 } |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
448 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
449 switch(mpi->imgfmt) { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
450 case IMGFMT_YUY2: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
451 case IMGFMT_UYVY: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
452 case IMGFMT_BGR8: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
453 case IMGFMT_BGR15: |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
454 case IMGFMT_BGR16: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
455 case IMGFMT_BGR24: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
456 case IMGFMT_BGR32: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
457 mpi->planes[0] = agp_mem + buf * buffer_size; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
458 mpi->stride[0] = src_stride; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
459 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
460 case IMGFMT_YV12: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
461 case IMGFMT_I420: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
462 mpi->planes[0] = agp_mem + buf * buffer_size; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
463 mpi->stride[0] = mpi->width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
464 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
|
465 mpi->stride[1] = mpi->chroma_width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
466 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
|
467 mpi->stride[2] = mpi->chroma_width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
468 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
469 default: |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
470 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_GetImageTodo); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
471 return VO_FALSE; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
472 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
473 mpi->flags |= MP_IMGFLAG_DIRECT; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
474 mpi->priv = (void*)buf; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
475 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
476 return VO_TRUE; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
477 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
478 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
479 static uint32_t start_slice(mp_image_t *mpi){ |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
480 int buf = 0; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
481 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
482 #ifdef VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
483 printf("Start slices %d\n",buf); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
484 #endif |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
485 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
486 if(mpi->flags & MP_IMGFLAG_DIRECT) |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
487 buf = (int)mpi->priv; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
488 current_buffer = buf; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
489 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
490 return VO_TRUE; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
491 } |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
492 |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
493 static uint32_t draw_image(mp_image_t *mpi){ |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
494 int buf = 0; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
495 tdfx_vid_agp_move_t mov; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
496 tdfx_vid_yuv_t yuv; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
497 int p; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
498 uint8_t* planes[3]; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
499 |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
500 #ifdef VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
501 printf("Draw image %d\n",buf); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
502 #endif |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
503 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
504 if(mpi->flags & MP_IMGFLAG_DIRECT) |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
505 buf = (int)mpi->priv; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
506 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
507 switch(mpi->imgfmt) { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
508 case IMGFMT_YUY2: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
509 case IMGFMT_UYVY: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
510 case IMGFMT_BGR8: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
511 case IMGFMT_BGR15: |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
512 case IMGFMT_BGR16: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
513 case IMGFMT_BGR24: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
514 case IMGFMT_BGR32: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
515 if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) { |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
516 // copy to agp_mem |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
517 #ifdef VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
518 printf("Memcpy\n"); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
519 #endif |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
520 planes[0] = agp_mem + buf * buffer_size; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
521 mem2agpcpy_pic(planes[0],mpi->planes[0],src_bpp*mpi->width,mpi->height, |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
522 buffer_stride[0],mpi->stride[0]); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
523 } else |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
524 planes[0] = agp_mem + buf * buffer_size; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
525 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
526 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
|
527 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
|
528 mov.height = mpi->height; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
529 mov.src = planes[0] - agp_mem; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
530 mov.src_stride = buffer_stride[0]; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
531 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
532 mov.dst = back_buffer; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
533 mov.dst_stride = src_stride; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
534 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
535 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
536 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailed); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
537 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
538 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
539 case IMGFMT_YV12: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
540 case IMGFMT_I420: |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
541 if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))) { |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
542 // Copy to agp mem |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
543 #ifdef VERBOSE |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
544 printf("Memcpy\n"); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
545 #endif |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
546 planes[0] = agp_mem + buf * buffer_size; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
547 memcpy_pic(planes[0],mpi->planes[0],mpi->width,mpi->height, |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
548 buffer_stride[0],mpi->stride[0]); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
549 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
|
550 memcpy_pic(planes[1],mpi->planes[1],mpi->chroma_width,mpi->chroma_height, |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
551 buffer_stride[1],mpi->stride[1]); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
552 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
|
553 memcpy_pic(planes[2],mpi->planes[2],mpi->chroma_width,mpi->chroma_height, |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
554 buffer_stride[2],mpi->stride[2]); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
555 } else { |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
556 planes[0] = agp_mem + buf * buffer_size; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
557 planes[1] = planes[0] + buffer_stride[0] * src_height; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
558 planes[2] = planes[1] + buffer_stride[1] * src_height/2; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
559 } |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
560 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
561 // Setup the yuv thing |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
562 yuv.base = back_buffer; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
563 yuv.stride = src_stride; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
564 if(ioctl(tdfx_fd,TDFX_VID_SET_YUV,&yuv)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
565 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_SetYuvFailed); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
566 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
567 } |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
568 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
569 |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
570 // Now agp move that |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
571 // Y |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
572 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
|
573 mov.width = mpi->width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
574 mov.height = mpi->height; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
575 mov.src = planes[0] - agp_mem; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
576 mov.src_stride = buffer_stride[0]; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
577 mov.dst = 0x0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
578 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
|
579 |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
580 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
581 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnYPlane); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
582 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
583 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
584 //return 0; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
585 // U |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
586 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
|
587 mov.width = mpi->chroma_width; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
588 mov.height = mpi->chroma_height; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
589 mov.src = planes[p] - agp_mem; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
590 mov.src_stride = buffer_stride[p]; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
591 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
|
592 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
593 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnUPlane); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
594 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
595 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
596 // V |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
597 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
|
598 mov.src = planes[p] - agp_mem; |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
599 mov.src_stride = buffer_stride[p]; |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
600 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
|
601 if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) { |
18234
a107276371a8
Part 5 and final of otvos attila's oattila AT chello-hu mp_msg changes, with lots of corrections
reynaldo
parents:
16171
diff
changeset
|
602 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnVPlane); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
603 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
604 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
605 break; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
606 default: |
18335 | 607 mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_UnknownFormat,mpi->imgfmt); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
608 return VO_TRUE; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
609 } |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
610 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
611 return VO_TRUE; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
612 } |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
613 |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
614 static uint32_t fullscreen(void) { |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
615 vo_fs ^= 1; |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
616 aspect(&dst_width,&dst_height,vo_fs ? A_ZOOM : A_NOZOOM); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
617 // This does not work :(( |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
618 //clear_screen(); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
619 return VO_TRUE; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
620 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
621 |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
622 static uint32_t set_window(mp_win_t* w) { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
623 if(!use_overlay) return VO_FALSE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
624 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
625 tdfx_ov.dst_x = w->x; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
626 tdfx_ov.dst_y = w->y; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
627 tdfx_ov.dst_width = w->w; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
628 tdfx_ov.dst_height = w->h; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
629 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
630 if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&tdfx_ov)) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
631 mp_msg(MSGT_VO, MSGL_V, "tdfx_vid: set window failed\n"); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
632 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
633 return VO_TRUE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
634 } |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
635 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
636 static uint32_t set_colorkey(mp_colorkey_t* colork) { |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
637 if(!use_overlay) return VO_FALSE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
638 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
639 tdfx_ov.colorkey[0] = tdfx_ov.colorkey[1] = colork->x11; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
640 tdfx_ov.use_colorkey = 1; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
641 tdfx_ov.invert_colorkey = 0; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
642 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
643 if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&tdfx_ov)) |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
644 mp_msg(MSGT_VO, MSGL_V, "tdfx_vid: set colorkey failed\n"); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
645 |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
646 return VO_TRUE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
647 } |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
648 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15212
diff
changeset
|
649 static int control(uint32_t request, void *data, ...) |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
650 { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
651 switch (request) { |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
652 case VOCTRL_QUERY_FORMAT: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
653 return query_format(*((uint32_t*)data)); |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
654 case VOCTRL_GET_IMAGE: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
655 return get_image(data); |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
656 case VOCTRL_DRAW_IMAGE: |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
657 return draw_image(data); |
9559
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
658 case VOCTRL_START_SLICE: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
659 return start_slice(data); |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
660 case VOCTRL_FULLSCREEN: |
9883afd390dc
Update, add support for DR and draw image. Sadly reading from the agp
albeu
parents:
9546
diff
changeset
|
661 return fullscreen(); |
9569
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
662 case VOCTRL_XOVERLAY_SUPPORT: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
663 return VO_TRUE; |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
664 case VOCTRL_XOVERLAY_SET_COLORKEY: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
665 return set_colorkey(data); |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
666 case VOCTRL_XOVERLAY_SET_WIN: |
894d02a6469e
vo_xover is a new vo that should make easy to have x11 support for
albeu
parents:
9567
diff
changeset
|
667 return set_window(data); |
9546
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
668 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
669 return VO_NOTIMPL; |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
670 } |
8feb4bb5b334
vo tdfx vid, even faster than tdfxfb and that's just the beginning ;)
albeu
parents:
diff
changeset
|
671 |