Gentoo Archives: gentoo-user

From: James Broadhead <jamesbroadhead@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] I want to play movies without hangs
Date: Sat, 18 Feb 2012 13:27:01
Message-Id: CA+hid6H8E1b8VekMSThKG41idNSVVVQMSiwkaPN0HYR53eXXDw@mail.gmail.com
In Reply to: Re: [gentoo-user] I want to play movies without hangs by Alex Schuster
1 On 18 February 2012 05:45, Alex Schuster <wonko@×××××××××.org> wrote:
2 > Walter Dnes writes:
3 >
4 >> On Thu, Feb 16, 2012 at 04:29:48PM +0100, Alex Schuster wrote
5 >>
6 >> > Then my hardware broke, and I got new one...
7 >>
8 >>   I had ***EXACTLY THE SAME PROBLEM ON A FRESH INSTALL***.  In My case
9 >> it was a 4+ year old Dell with onboard Intel GPU that was having
10 >> problems playing NHL Gamecenter Live streams at the slowest speed.  I
11 >> solved the problem and sped up everything by doing...
12 >> 1) emerge system
13 >> 2) emerge world
14 >> 3) rebuild the kernel and reboot
15 >
16 > Good idea, Walter! But not in my case. The system had been set up long
17 > ago, and I did an emerge -e @world in the past already.
18 >
19 >>   A fresh install will have the stage 3 binaries built with
20 >> lowest-common-denominator x86 or amd64 code (depending if you chose 32
21 >> or 64 bit install).  This is necessary in order to allow the install
22 >> code to run on all CPUs with the target platform.  The downside is that
23 >> you lose all the optimisations that make Gentoo scream.  Rebuilding the
24 >> install as described above builds optimized (i.e. faster) binaries.  My
25 >> CFLAGS line in /etc/make.conf is...
26 >>
27 >> CFLAGS="-O2 -march=native -mfpmath=sse -fomit-frame-pointer -pipe"
28 >> CXXFLAGS="${CFLAGS}"
29 >
30 > I had those, when I upgraded the hardware:
31 > CFLAGS="-march=k8-sse3 -mfpmath=sse -O2 -pipe"
32 > Or something very silimar.
33 >
34 > But I also just did an emerge -e @world on the new system, using more
35 > sophisticated CFLAGS. I got them by doing like suggested on [*], using
36 > what -march=natve would do. And adding support for this graphite
37 > stuff. They are:
38 > CFLAGS="-pipe -march=amdfam10 -O2 \
39 >        -floop-interchange -floop-strip-mine -floop-block \
40 >        -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -m3dnow \
41 >        -mcx16 -msahf -maes -mpclmul -mpopcnt -mabm -mlwp -mavx \
42 >        --param l1-cache-size=16 --param l1-cache-line-size=64 \
43 >        --param l2-cache-size=2048"
44 >
45 >>   Before rebuilding your system, go over your USE flags to make sure
46 >> you've got the maximum optimization.  To find out what your CPU
47 >> supports, execute the command
48 >>
49 >> grep flags /proc/cpuinfo | head -1
50 >>
51 >>   This will define the limits what your system can support.  For
52 >> instance, mplayer can use the following flags...
53 >>
54 >> waltdnes@d530 ~ $ emerge -pv mplayer
55 >>
56 >> These are the packages that would be merged, in order:
57 >>
58 >> Calculating dependencies... done!
59 >> [ebuild   R    ] media-video/mplayer-1.0_rc4_p20110322-r1  USE="X a52
60 >> alsa ass dga encode gif jpeg mmx mmxext mng mp3 opengl png quicktime
61 >> real rtmp sse sse2 ssse3 theora truetype win32codecs x264 xv xvid xvmc
62 >> -3dnow -3dnowext -aalib (-altivec) -amr (-aqua) -bidi -bindist -bl
63 >> -bluray -bs2b -cddb -cdio -cdparanoia -cpudetection -custom-cpuopts
64 >> -debug -dirac -directfb -doc -dts -dv -dvb -dvd -dvdnav (-dxr3) -enca
65 >> (-esd) -faac -faad -fbcon -ftp -ggi -gsm -iconv -ipv6 -jack -joystick
66 >> -jpeg2k -ladspa -libcaca -libmpeg2 -lirc -live -lzo -mad -md5sum
67 >> -mpg123 -nas -network -nut -openal -osdmenu -oss -pnm -pulseaudio -pvr
68 >> -radio -rar -rtc -samba -schroedinger -sdl -shm -speex -tga -toolame
69 >> -tremor -twolame -unicode -v4l -vdpau -vidix -vorbis -vpx -xanim
70 >> -xinerama -xscreensaver -zoran" VIDEO_CARDS="-mga -s3virge -tdfx -vesa"
71 >> 0 kB
72 >>
73 >>   Your CPU will obviously support a different set of USE flags than
74 >> mine.  Check the files /usr/portage/profiles/use.desc for a list of
75 >> global flags and /usr/portage/profiles/use.local.desc for
76 >> package-specific flags.
77 >
78 > These are my USE flags for mplayer, they should be fine:
79 > [ebuild   R    ] media-video/mplayer-1.0_rc4_p20120213  USE="3dnow
80 > 3dnowext X a52 aalib alsa ass cdio dga directfb dts dv dvb dvd dvdnav
81 > enca encode faad fbcon ftp ggi gif iconv ipv6 jack jpeg jpeg2k live mad
82 > mmx mmxext mng mp3 nas network openal opengl osdmenu oss png pnm
83 > quicktime rar real rtc samba sdl shm speex sse sse2 ssse3 theora toolame
84 > tremor truetype twolame unicode vorbis x264 xinerama xscreensaver xv xvid
85 > (-altivec) (-aqua) -bidi -bindist -bl -bluray -bs2b -cddb -cdparanoia
86 > -cpudetection -debug -doc (-dxr3) (-esd) -faac -gsm -joystick -ladspa
87 > -libcaca -libmpeg2 -lirc -lzo -md5sum -nut -pulseaudio -pvr -radio -rtmp
88 > -tga -v4l -vdpau (-vidix) (-win32codecs) -xanim -xvmc -zoran"
89 > VIDEO_CARDS="-mga -s3virge -tdfx" 0 kB
90 >
91 > Now I'm bulding a new kernel, using genkernel, and without providing a
92 > custom made .config. Just in case I have some weird setting somewhere
93 > (debug output for SCSI stuff or something like that).
94 >
95 > [later...]
96 >
97 > So I did. Argh. I thought genkernel was smart enough to generate a
98 > working kernel from scratch, if no existing .config would be given. But
99 > the initramfs could not open my encrypted root partition, until I compiled
100 > XTS and AES directly into the kernel, not only as modules. Genkernel did
101 > not include modules for my NIC, somewhat annoying because I had to wait
102 > several minutes for mysql to start, until I could open a root shell. KDM
103 > was already running at that time, but I only saw a blank screen, because
104 > the radeon stuff was not compiled with KMS. There's also something
105 > wrong with my hardware clock. And iotop does not work, the kernel is
106 > missing CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT
107 > and CONFIG_TASK_IO_ACCOUNTING.
108 >
109 > But now I have KDE running again. As soon as I do my dd command, mplayer
110 > stutters, sometimes hanging for seconds. So it's probably not a flaw in
111 > my kernel .config. Too bad, I hoped that was the problem.
112 >
113 > I'm out of ideas now. This is really annoying, my system is fast, mplayer
114 > is using around 20% only, the system is mostly idle, but when there is
115 > I/O, videos do not run smoothly. And I do not want to copy every movie I
116 > want to watch to another drive first.
117 >
118 > BTW, when I do the dd if=/dev/zero of=/home/argh bs=10M count=1000
119 > command, and interrupt with Ctrl-C, it takes some seconds until it stops.
120 > Shouldn't this happen immediately, unless I specify a very large block
121 > size? Writing speed is okay, 100 MB/s.
122 >
123 > Time to go to sleep now.
124 >
125 > [*] http://en.gentoo-wiki.com/wiki/Safe_Cflags#-march.3Dnative
126 >
127 >        Wonko
128 >
129
130 Please try:
131 ~/.mplayer/config
132 lavdopts=threads=2
133 # Use 128MiB input cache by default.
134 cache = 131072
135 # Prefill 20% of the cache before starting playback.
136 cache-min = 20.0
137
138 Which should eliminate disk IO somewhat

Replies

Subject Author
Re: [gentoo-user] I want to play movies without hangs Alex Schuster <wonko@×××××××××.org>