annotate DOCS/tech/vidix.txt @ 4689:61f4b8fd380e

Fixing "quake" by direct waiting of vsync. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (I don't why - but SMART_SWITCH is always disabled on my card) Benchmarks: [SRC] VIDEO: [DIV3] 624x356 24bpp 24.00 fps 497.3 kbps (60.7 kbyte/s) [DEST] 1024x768@32 70fps (-xvidix -fs -zoom) -vc ffdivx -double: BENCHMARKs: V: 3.838s VO: 7.305s A: 0.555s Sys: 18.264s = 29.962s BENCHMARK%: V: 12.8110% VO: 24.3808% A: 1.8518% Sys: 60.9564% = 100.0000% total video time: 11.143s -vc ffdivx -nodouble: BENCHMARKs: V: 3.846s VO: 1.668s A: 0.539s Sys: 23.869s = 29.922s BENCHMARK%: V: 12.8525% VO: 5.5744% A: 1.8015% Sys: 79.7716% = 100.0000% total video time: 5.514s -vc divxds -double (direct rendering) BENCHMARKs: V: 8.275s VO: 5.750s A: 0.532s Sys: 15.414s = 29.971s BENCHMARK%: V: 27.6115% VO: 19.1850% A: 1.7737% Sys: 51.4298% = 100.0000% total video time: 14.070s -vc divxds -nodouble (direct rendering) BENCHMARKs: V: 7.353s VO: 0.002s A: 0.521s Sys: 22.083s = 29.958s BENCHMARK%: V: 24.5433% VO: 0.0052% A: 1.7382% Sys: 73.7133% = 100.0000% total video time: 7.355s Unfortunately we have dramatic lost of performance (100%) :(
author nick
date Wed, 13 Feb 2002 08:24:13 +0000
parents c012c026d0e8
children 0f1b5b68af32
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4103
917aff165995 Documentation
nick
parents:
diff changeset
1 VIDIX - VIDeo Interface for *niX
917aff165995 Documentation
nick
parents:
diff changeset
2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
3
917aff165995 Documentation
nick
parents:
diff changeset
4 This interface was designed and introduced as interface to userspace drivers
917aff165995 Documentation
nick
parents:
diff changeset
5 to provide DGA everywhere where it's possible (unline X11).
917aff165995 Documentation
nick
parents:
diff changeset
6 I hope that these drivers will be portable same as X11 (not only on *nix).
917aff165995 Documentation
nick
parents:
diff changeset
7
917aff165995 Documentation
nick
parents:
diff changeset
8 What is it:
917aff165995 Documentation
nick
parents:
diff changeset
9 - It's portable successor of mga_vid technology which is located in user-space.
917aff165995 Documentation
nick
parents:
diff changeset
10 - Unlikely X11 it's provides DGA everywhere where it's possible.
917aff165995 Documentation
nick
parents:
diff changeset
11 - Unlikely v4l it provides interface for video playback
917aff165995 Documentation
nick
parents:
diff changeset
12 - Unlikely linux's drivers it uses mathematics library.
917aff165995 Documentation
nick
parents:
diff changeset
13
917aff165995 Documentation
nick
parents:
diff changeset
14 Why it was developed:
917aff165995 Documentation
nick
parents:
diff changeset
15 As said Vladimir Dergachev
917aff165995 Documentation
nick
parents:
diff changeset
16 (http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/gatos/km/km.rfc.txt):
917aff165995 Documentation
nick
parents:
diff changeset
17 "0) Motivation
917aff165995 Documentation
nick
parents:
diff changeset
18 v4l, v4l2 and Xv are all suffering from the same problem: attempt to fit
917aff165995 Documentation
nick
parents:
diff changeset
19 existing multimedia devices into a fixed scheme."
917aff165995 Documentation
nick
parents:
diff changeset
20 Well - I tried to implement something similar by motivation.
917aff165995 Documentation
nick
parents:
diff changeset
21
917aff165995 Documentation
nick
parents:
diff changeset
22 How it works:
917aff165995 Documentation
nick
parents:
diff changeset
23 ~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
24
917aff165995 Documentation
nick
parents:
diff changeset
25 This interface is almost finished. But I guess it can be expanded by developer's
917aff165995 Documentation
nick
parents:
diff changeset
26 requests.
917aff165995 Documentation
nick
parents:
diff changeset
27 So any suggestions, reports, criticism are gladly accepted.
917aff165995 Documentation
nick
parents:
diff changeset
28
917aff165995 Documentation
nick
parents:
diff changeset
29 1) APP calls vixGetVersion to check age of driver ;)
917aff165995 Documentation
nick
parents:
diff changeset
30 2) APP calls vixProbe. Driver should return 0 if it can handle something in PC.
917aff165995 Documentation
nick
parents:
diff changeset
31 3) APP calls vixGetCapability. Driver should return filled
917aff165995 Documentation
nick
parents:
diff changeset
32 vidix_capability_t.type field at least.
917aff165995 Documentation
nick
parents:
diff changeset
33 4) If above calls were succesful then APP calls vixInit function
917aff165995 Documentation
nick
parents:
diff changeset
34 (Driver can have not exported this function in this case call will be
917aff165995 Documentation
nick
parents:
diff changeset
35 skiped).
917aff165995 Documentation
nick
parents:
diff changeset
36 5) After initializing of driver APP calls vixGetCapability again
917aff165995 Documentation
nick
parents:
diff changeset
37 (In this case driver must fill every field of struct)
917aff165995 Documentation
nick
parents:
diff changeset
38 6) APP calls vixQueryFourcc. Driver should answer - can it configure
917aff165995 Documentation
nick
parents:
diff changeset
39 video memory for given fourcc or not.
917aff165995 Documentation
nick
parents:
diff changeset
40 7) APP calls vixConfigPlayback. Driver should prepare BES on this call.
917aff165995 Documentation
nick
parents:
diff changeset
41 APP pass to driver following info:
917aff165995 Documentation
nick
parents:
diff changeset
42 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
43 vidix_playback_t.fourcc - contains fourcc of movie
917aff165995 Documentation
nick
parents:
diff changeset
44 vidix_playback_t.capability - currently contsinas copy of vidix_capability_t.flags
917aff165995 Documentation
nick
parents:
diff changeset
45 vidix_playback_t.blend_factor- currently unused
4435
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
46 vidix_playback_t.src - x,y,w,h fields contain original movie size
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
47 (in pixels) x and y often are nulls.
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
48 vidix_playback_t.src.pitch.y These fields contain source pitches
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
49 vidix_playback_t.src.pitch.u - for each Y,U,V plane in bytes.
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
50 vidix_playback_t.src.pitch.v (For packed fourcc only Y value is used)
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
51 They are hints for driver to use same destinition
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
52 pitches as in source memory (to speed up
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
53 memcpy process).
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
54 Note: when source pitches are unknown or
c012c026d0e8 Documenting new tune info
nick
parents: 4195
diff changeset
55 variable these field will be filled into 0.
4103
917aff165995 Documentation
nick
parents:
diff changeset
56 vidix_playback_t.dest - x,y,w,h fields contains destinition rectange
917aff165995 Documentation
nick
parents:
diff changeset
57 on the screen in pixels.
917aff165995 Documentation
nick
parents:
diff changeset
58 vidix_playback_t.num_frames - maximal # of frames which can be used by APP.
917aff165995 Documentation
nick
parents:
diff changeset
59 (Currently 10).
917aff165995 Documentation
nick
parents:
diff changeset
60 Driver should fill following fields:
917aff165995 Documentation
nick
parents:
diff changeset
61 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
62 vidix_playback_t.num_frames - real # of frames which will be used by driver.
917aff165995 Documentation
nick
parents:
diff changeset
63 (Should be less or equal to app's num_frames).
917aff165995 Documentation
nick
parents:
diff changeset
64
917aff165995 Documentation
nick
parents:
diff changeset
65 vidix_playback_t.dest.pitch.y These fields should contain alignment
917aff165995 Documentation
nick
parents:
diff changeset
66 vidix_playback_t.dest.pitch.u - for each Y,U,V plane in bytes.
917aff165995 Documentation
nick
parents:
diff changeset
67 vidix_playback_t.dest.pitch.v (For packed fourcc only Y value is used)
917aff165995 Documentation
nick
parents:
diff changeset
68
917aff165995 Documentation
nick
parents:
diff changeset
69 vidix_playback_t.frame_size - Driver should tell to app which size of
917aff165995 Documentation
nick
parents:
diff changeset
70 source frame (src.w and src.h) should
917aff165995 Documentation
nick
parents:
diff changeset
71 use APP (according to pitches and offsets)
917aff165995 Documentation
nick
parents:
diff changeset
72
917aff165995 Documentation
nick
parents:
diff changeset
73 vidix_playback_t.offsets - offsets from begin of BES memory for each frame
917aff165995 Documentation
nick
parents:
diff changeset
74
917aff165995 Documentation
nick
parents:
diff changeset
75 vidix_playback_t.offset.y These field should contain offset
917aff165995 Documentation
nick
parents:
diff changeset
76 vidix_playback_t.offset.u - for each Y,U,V plane within frame.
917aff165995 Documentation
nick
parents:
diff changeset
77 vidix_playback_t.offset.v (For packed fourcc only Y value is used)
917aff165995 Documentation
nick
parents:
diff changeset
78
917aff165995 Documentation
nick
parents:
diff changeset
79 vidix_playback_t.dga_addr - Address of BES memory.
917aff165995 Documentation
nick
parents:
diff changeset
80
917aff165995 Documentation
nick
parents:
diff changeset
81 Also see this picture:
917aff165995 Documentation
nick
parents:
diff changeset
82
917aff165995 Documentation
nick
parents:
diff changeset
83 VIDEO MEMORY layout:
917aff165995 Documentation
nick
parents:
diff changeset
84 +----------- It's begin of video memory End of video memory--------------+
917aff165995 Documentation
nick
parents:
diff changeset
85 | |
917aff165995 Documentation
nick
parents:
diff changeset
86 v v
917aff165995 Documentation
nick
parents:
diff changeset
87 [ RGB memory | YUV memory | UNDEF ]
917aff165995 Documentation
nick
parents:
diff changeset
88 ^
917aff165995 Documentation
nick
parents:
diff changeset
89 |
917aff165995 Documentation
nick
parents:
diff changeset
90 +---- begin of BES memory
917aff165995 Documentation
nick
parents:
diff changeset
91
917aff165995 Documentation
nick
parents:
diff changeset
92 BES MEMORY layout:
917aff165995 Documentation
nick
parents:
diff changeset
93 +-------- begin of BES memory
917aff165995 Documentation
nick
parents:
diff changeset
94 |
917aff165995 Documentation
nick
parents:
diff changeset
95 v
917aff165995 Documentation
nick
parents:
diff changeset
96 [ | | | | |
917aff165995 Documentation
nick
parents:
diff changeset
97 ^ ^ ^ ^ ^
917aff165995 Documentation
nick
parents:
diff changeset
98 | | | | + BEGIN of second frame
917aff165995 Documentation
nick
parents:
diff changeset
99 | | | + BEGIN of V plane
917aff165995 Documentation
nick
parents:
diff changeset
100 | | + BEGIN of U plane
917aff165995 Documentation
nick
parents:
diff changeset
101 | +------- BEGIN of Y plane
917aff165995 Documentation
nick
parents:
diff changeset
102 |
917aff165995 Documentation
nick
parents:
diff changeset
103 +--------- BEGIN of first frame
917aff165995 Documentation
nick
parents:
diff changeset
104
917aff165995 Documentation
nick
parents:
diff changeset
105 This means that in general case:
917aff165995 Documentation
nick
parents:
diff changeset
106 offset of frame != offset of BES
917aff165995 Documentation
nick
parents:
diff changeset
107 offset of Y plane != offset of first frame
917aff165995 Documentation
nick
parents:
diff changeset
108
917aff165995 Documentation
nick
parents:
diff changeset
109 But often: vidix_playback_t.offsets[0] = vidix_playback_t.offset.y = 0;
917aff165995 Documentation
nick
parents:
diff changeset
110
917aff165995 Documentation
nick
parents:
diff changeset
111 Formula: (For Y plane) copy source to:
917aff165995 Documentation
nick
parents:
diff changeset
112 vidix_playback_t.dga_addr +
917aff165995 Documentation
nick
parents:
diff changeset
113 vidix_playback_t.offsets[i] +
917aff165995 Documentation
nick
parents:
diff changeset
114 vidix_playback_t.offset.y
917aff165995 Documentation
nick
parents:
diff changeset
115
917aff165995 Documentation
nick
parents:
diff changeset
116 8) APP calls vixPlaybackOn. Driver should activate BES on this call.
917aff165995 Documentation
nick
parents:
diff changeset
117 9) PLAYBACK. Driver should sleep here ;)
917aff165995 Documentation
nick
parents:
diff changeset
118 But during playback can be called:
917aff165995 Documentation
nick
parents:
diff changeset
119 vixFrameSelect (if this function is exported)
917aff165995 Documentation
nick
parents:
diff changeset
120 Driver should prepare and activate corresponded frame.
917aff165995 Documentation
nick
parents:
diff changeset
121 This function is used only for double and trilpe buffering and
917aff165995 Documentation
nick
parents:
diff changeset
122 never used for single buffering playback.
917aff165995 Documentation
nick
parents:
diff changeset
123 vixGet(Set)GrKeys (if this function is exported)
917aff165995 Documentation
nick
parents:
diff changeset
124 This interface should be tuned but intriduced for overlapped playback
917aff165995 Documentation
nick
parents:
diff changeset
125 and video effects (TYPE_FX)
917aff165995 Documentation
nick
parents:
diff changeset
126 vixPlaybackGet(Set)Eq (if this function is exported)
917aff165995 Documentation
nick
parents:
diff changeset
127 For color correction.
917aff165995 Documentation
nick
parents:
diff changeset
128 10) APP calls vixPlaybackOff. Driver should deactivate BES on this call.
917aff165995 Documentation
nick
parents:
diff changeset
129 11) If vixDestroy is defined APP calls this function before unloading driver
917aff165995 Documentation
nick
parents:
diff changeset
130 from memory.
917aff165995 Documentation
nick
parents:
diff changeset
131
917aff165995 Documentation
nick
parents:
diff changeset
132
917aff165995 Documentation
nick
parents:
diff changeset
133 What functions are mandatory:
917aff165995 Documentation
nick
parents:
diff changeset
134 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
917aff165995 Documentation
nick
parents:
diff changeset
135 vixGetVersion
917aff165995 Documentation
nick
parents:
diff changeset
136 vixProbe
917aff165995 Documentation
nick
parents:
diff changeset
137 vixGetCapability
917aff165995 Documentation
nick
parents:
diff changeset
138 vixQueryFourcc
917aff165995 Documentation
nick
parents:
diff changeset
139 vixConfigPlayback
917aff165995 Documentation
nick
parents:
diff changeset
140 vixPlaybackOn
917aff165995 Documentation
nick
parents:
diff changeset
141 vixPlaybackOff
917aff165995 Documentation
nick
parents:
diff changeset
142
917aff165995 Documentation
nick
parents:
diff changeset
143 All other functions are optionaly.
917aff165995 Documentation
nick
parents:
diff changeset
144
4195
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
145 Useful links:
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
146 ~~~~~~~~~~~~~
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
147 Guide to DTV http://www.digitaltelevision.com/dtvbook/toc.shtml
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
148 Fourcc http://www.webartz.com/fourcc/
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
149 MPEG http://www.mpeg.org/MPEG/index.html
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
150 Analog colors http://www.miranda.com/en/app_notes/TN/TN-05/TN-05.htm
b086b94ec244 Useful links
nick
parents: 4103
diff changeset
151
4103
917aff165995 Documentation
nick
parents:
diff changeset
152 Please send your suggestions, reports, feedback to mplayer-dev-eng@mplayerhq.hu
917aff165995 Documentation
nick
parents:
diff changeset
153 Best regards! Nick Kurshev.