Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 344877 - x11-libs/libcrystalhd ebuild for library and kernel module
Summary: x11-libs/libcrystalhd ebuild for library and kernel module
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement with 1 vote (vote)
Assignee: Default Assignee for New Packages
URL: http://www.broadcom.com/support/cryst...
Whiteboard:
Keywords:
Depends on:
Blocks: 350375 531692
  Show dependency tree
 
Reported: 2010-11-10 04:52 UTC by Tom Flair
Modified: 2014-12-14 16:42 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Attatched ebuild (crystalhd-20101107.ebuild,2.67 KB, text/plain)
2010-11-10 04:54 UTC, Tom Flair
Details
Updated (crystalhd-20101130.ebuild,2.83 KB, text/plain)
2010-12-12 03:23 UTC, Tom Flair
Details
Minor update, theoretical AppleTV support (crystalhd-20110123-r1.ebuild,3.05 KB, text/plain)
2011-02-23 05:13 UTC, Tom Flair
Details
Patch for CrystalHD support (crystalhd-appletv.patch,526 bytes, patch)
2011-02-23 05:15 UTC, Tom Flair
Details | Diff
Applies AppleTV patch correctly to -9999 (crystalhd-20110123-r1.ebuild,3.07 KB, text/plain)
2011-02-23 19:17 UTC, Tom Flair
Details
Builds from a different tree (crystalhd-for-osx-9999.ebuild,3.39 KB, text/plain)
2011-02-24 21:00 UTC, Tom Flair
Details
x11-libs/crystalhd-appletv-156.ebuild (crystalhd-appletv-156.ebuild,2.41 KB, text/plain)
2011-04-02 02:39 UTC, Tom Flair
Details
x11-libs/crystalhd-appletv patch to support kernel changes since r156 (crystalhd-appletv-ioctl.patch,913 bytes, text/plain)
2011-04-02 02:40 UTC, Tom Flair
Details
x11-libs/crystalhd-20110314.ebuild (crystalhd-20110314.ebuild,2.83 KB, text/plain)
2011-04-02 03:15 UTC, Tom Flair
Details
x11-libs/libcrystalhd-3.22.0.ebuild (libcrystalhd-3.22.0.ebuild,2.71 KB, text/plain)
2011-04-02 19:23 UTC, Tom Flair
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Flair 2010-11-10 04:52:51 UTC
An ebuild for the Broadcom CrystalHD decoder cards.  This installs the library, the required firmware and (optionally) the kernel module.

I had issues with Broadcom's provided package, so I have opted to use a snapshot from the upstream git repository.  I borrowed an element from the mplayer-9999 package so this will also serve as a live ebuild if needed.

There is an option to build gstreamer support, but that's outside of what could piece together and likely belongs in a separate ebuild.

Reproducible: Always

Steps to Reproduce:
Comment 1 Tom Flair 2010-11-10 04:54:14 UTC
Created attachment 253835 [details]
Attatched ebuild
Comment 2 Tom Flair 2010-12-12 03:23:38 UTC
Created attachment 256936 [details]
Updated

Now installs udev rule and optionally example test programs.
Comment 3 Marco Schinkel 2010-12-23 14:05:22 UTC
(In reply to comment #2)
> Created an attachment (id=256936) [details]
> Updated
> 
> Now installs udev rule and optionally example test programs.
> 

Thank you. The ebuild works without problems after I created a cloned the git and put the files into /usr/portage/distfiles/crystalhd-20101130.tbz2.

Comment 4 h2sammo 2011-02-19 04:09:55 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Created an attachment (id=256936) [details] [details]
I am having problems digesting the ebuild. I think the problem is with the eclass as I have had this problem with the mythtv ebuild. they have a corrected eclass. is there a similar effort for the crystalhd eclass?

also, I have crystalhd enabled in my kernel. will i still have crystalhd support if i do NOT enable the crystalhd USE flag as I dont seem to need it?
Comment 5 Tom Flair 2011-02-19 04:35:01 UTC
(In reply to comment #4)
> I am having problems digesting the ebuild. I think the problem is with the
> eclass as I have had this problem with the mythtv ebuild. they have a corrected
> eclass. is there a similar effort for the crystalhd eclass?
> 
> also, I have crystalhd enabled in my kernel. will i still have crystalhd
> support if i do NOT enable the crystalhd USE flag as I dont seem to need it?
> 

There isn't a specific eclass for this ebuild; it relies on the git.eclass when named -9999.  I have these versioned using the date of the particular commit.

20101130 indicates the commits to the tree at that day.  I clone the repository, create a tbz2, and manifest the build using that.  It's my hope if this gets accepted that this will continue.

Otherwise, save this as crystalhd-9999.ebuild and manifest it.  It will build as a live ebuild against whatever is current.  I could find a way to host the snapshots, but I find explaining it works as well.

To your second question, no.  MythTV and XBMC rely on the libraries installed and the kernel module itself is useless without the firmware.  This ebuild will install the libraries and firmware necessary.  I honestly haven't had any luck with the kernel module recognizing my BCM70015, so I continue to build the module with this ebuild.  

So, to sum up:
Save as media-libs/crystalhd-9999.ebuild
ebuild media-libs/crystalhd-9999.ebuild manifest
USE=-modules emerge --ask --verbose media-libs/crystalhd (since you choose to install the in-kernel module)
Enjoy!
Comment 6 h2sammo 2011-02-19 14:48:29 UTC
(In reply to comment #5)
i will try to install the libraries and let you know the difference. i currently run XBMC with the module coming from the kernel only and it works fine (most of the time). Sometimes the module seems is not used and i have to close xbmc, modprobe -r the module, then modprobe it again, restart XBMC, and voila, it works again... but i hope these libs you have here will work better.

will let you know
Comment 7 h2sammo 2011-02-19 15:36:35 UTC
(In reply to comment #6)
connection time out from git.wilsonet.com/crystalhd.git repo. any ideas why? i am not behind a firewall.

Comment 8 Tom Flair 2011-02-19 15:42:59 UTC
(In reply to comment #7)
> (In reply to comment #6)
> connection time out from git.wilsonet.com/crystalhd.git repo. any ideas why? i
> am not behind a firewall.
> 

It looks like his site is offline currently:
http://www.downforeveryoneorjustme.com/http://git.wilsonet.com

And I misspoke earlier, I have this in x11-libs/crystalhd.  The logic being libvdpau is in x11-libs and performs somewhat similar tasks.
Comment 9 h2sammo 2011-02-20 23:55:32 UTC
want to try the modules from this package instead of kernel but i cannot compile:


/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux/crystalhd_flea_ddr.c: In function 'crystalhd_flea_ddr_pll_config':
/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux/crystalhd_flea_ddr.c:152: error: implicit declaration of function 'msleep_interruptible'
make[2]: *** [/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux/crystalhd_flea_ddr.o] Error 1
make[1]: *** [_module_/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.35-gentoo-r12'
make: *** [all] Error 2
emake failed
 * ERROR: x11-libs/crystalhd-9999 failed:
 *   Unable to emake HOSTCC=i686-pc-linux-gnu-gcc CROSS_COMPILE=i686-pc-linux-gnu- LDFLAGS=  KERN_DIR=/usr/src/linux KERNOUT=/usr/src/linux all
 * 
 * Call stack:
 *     ebuild.sh, line   56:  Called src_compile
 *   environment, line 4638:  Called linux-mod_src_compile
 *   environment, line 3685:  Called die
 * The specific snippet of code:
 *               eval "emake HOSTCC=\"$(tc-getBUILD_CC)\"                                               CROSS_COMPILE=${CHOST}-                                                 LDFLAGS=\"$(get_abi_LDFLAGS)\"                                          ${BUILD_FIXES}                ${BUILD_PARAMS}                                          ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";
 * 
 * If you need support, post the output of 'emerge --info =x11-libs/crystalhd-9999',
 * the complete build log and the output of 'emerge -pqv =x11-libs/crystalhd-9999'.
 * This ebuild is from an overlay: '/usr/local/portage/'
 * The complete build log is located at '/var/tmp/portage/x11-libs/crystalhd-9999/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/x11-libs/crystalhd-9999/temp/environment'.
 * S: '/var/tmp/portage/x11-libs/crystalhd-9999/work'

>>> Failed to emerge x11-libs/crystalhd-9999, Log file:

>>>  '/var/tmp/portage/x11-libs/crystalhd-9999/temp/build.log'
localhost linux # cat /etc/make.conf
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
USE="mmx lirc -cups -cdr bluetooth nvidia hal dbus X alsa java nsplugin"
LINGUAS="en"
INPUT_DEVICES="evdev"
VIDEO_CARDS="nvidia"
MAKEOPTS="-j2"
ACCEPT_LICENSE="*"
LIRC_DEVICES="macmini"
PORTAGE_ELOG_CLASSES="log"
PORTAGE_ELOG_SYSTEM="save"
CCACHE_SIZE="2G"
PORTAGE_ELOG_CLASSES="info warn error log"
PORTAGE_ELOG_SYSTEM="save"
#source /usr/local/portage/make.conf
source /var/lib/layman/make.conf
PORTDIR_OVERLAY="/usr/local/portage"
Comment 10 h2sammo 2011-02-21 00:16:58 UTC
want to try the modules from this package instead of kernel but i cannot compile:


/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux/crystalhd_flea_ddr.c: In function 'crystalhd_flea_ddr_pll_config':
/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux/crystalhd_flea_ddr.c:152: error: implicit declaration of function 'msleep_interruptible'
make[2]: *** [/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux/crystalhd_flea_ddr.o] Error 1
make[1]: *** [_module_/var/tmp/portage/x11-libs/crystalhd-9999/work/driver/linux] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.35-gentoo-r12'
make: *** [all] Error 2
emake failed
 * ERROR: x11-libs/crystalhd-9999 failed:
 *   Unable to emake HOSTCC=i686-pc-linux-gnu-gcc CROSS_COMPILE=i686-pc-linux-gnu- LDFLAGS=  KERN_DIR=/usr/src/linux KERNOUT=/usr/src/linux all
 * 
 * Call stack:
 *     ebuild.sh, line   56:  Called src_compile
 *   environment, line 4638:  Called linux-mod_src_compile
 *   environment, line 3685:  Called die
 * The specific snippet of code:
 *               eval "emake HOSTCC=\"$(tc-getBUILD_CC)\"                                               CROSS_COMPILE=${CHOST}-                                                 LDFLAGS=\"$(get_abi_LDFLAGS)\"                                          ${BUILD_FIXES}                ${BUILD_PARAMS}                                          ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";
 * 
 * If you need support, post the output of 'emerge --info =x11-libs/crystalhd-9999',
 * the complete build log and the output of 'emerge -pqv =x11-libs/crystalhd-9999'.
 * This ebuild is from an overlay: '/usr/local/portage/'
 * The complete build log is located at '/var/tmp/portage/x11-libs/crystalhd-9999/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/x11-libs/crystalhd-9999/temp/environment'.
 * S: '/var/tmp/portage/x11-libs/crystalhd-9999/work'

>>> Failed to emerge x11-libs/crystalhd-9999, Log file:

>>>  '/var/tmp/portage/x11-libs/crystalhd-9999/temp/build.log'
localhost linux # cat /etc/make.conf
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
USE="mmx lirc -cups -cdr bluetooth nvidia hal dbus X alsa java nsplugin"
LINGUAS="en"
INPUT_DEVICES="evdev"
VIDEO_CARDS="nvidia"
MAKEOPTS="-j2"
ACCEPT_LICENSE="*"
LIRC_DEVICES="macmini"
PORTAGE_ELOG_CLASSES="log"
PORTAGE_ELOG_SYSTEM="save"
CCACHE_SIZE="2G"
PORTAGE_ELOG_CLASSES="info warn error log"
PORTAGE_ELOG_SYSTEM="save"
#source /usr/local/portage/make.conf
source /var/lib/layman/make.conf
PORTDIR_OVERLAY="/usr/local/portage"
Comment 11 Tom Flair 2011-02-21 00:45:21 UTC
(In reply to comment #10)
> want to try the modules from this package instead of kernel but i cannot
> compile:

Can you post your emerge --info and a link to your kernel config?   I've built this on x86 multiple times without issue.  I just built it again using 2.6.36-gentoo-r6 without issue.
Comment 12 h2sammo 2011-02-21 01:13:13 UTC
localhost linux # emerge --info
Portage 2.1.9.25 (default/linux/x86/10.0/desktop, gcc-4.4.4, glibc-2.11.2-r3, 2.6.35-gentoo-r12v03 i686)
=================================================================
System uname: Linux-2.6.35-gentoo-r12v03-i686-Genuine_Intel-R-_processor_1.00GHz-with-gentoo-1.12.14
Timestamp of tree: Sun, 20 Feb 2011 01:30:01 +0000
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.6.6-r1, 3.1.2-r4
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 1.12.14-r1
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa berkdb bluetooth branding bzip2 cairo cli consolekit cracklib crypt cxx dbus dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gdu gif gpm gtk hal iconv ipv6 java jpeg lcms ldap libnotify lirc mad mikmod mmx mng modules mp3 mp4 mpeg mudflap ncurses nls nptl nptlonly nsplugin nvidia ogg opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3support qt4 readline sdl session spell ssl startup-notification svg sysfs tcpd tiff truetype udev unicode usb vorbis x264 x86 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" LIRC_DEVICES="macmini" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

my kernel config: http://ompldr.org/vN2h3MA
Comment 13 Tom Flair 2011-02-21 12:47:57 UTC
(In reply to comment #10)

Make sure SMP is enabled. Without that enabled, I get the same failures you've reported using your config.

Processor type and features | Symmetric multi-processing support
Comment 14 h2sammo 2011-02-21 19:12:40 UTC
thank you. it compiled now. i will report later if i can notice differences. i noticed in the compilation a note about "2 section mismatches". not sure if thats a big deal.

Comment 15 h2sammo 2011-02-22 03:08:00 UTC
so it compiles fine but i cannot get it to be used. the condition occurring "sometimes" with the kernel module is now occurring every time:

Loading crystalhd v3.10.0
crystalhd 0000:02:00.0: Starting Device:0x1612
crystalhd 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
crystalhd 0000:02:00.0: MSI request failed..
crystalhd 0000:02:00.0: setting latency timer to 64
crystalhd 0000:02:00.0: Opening new user[0] handle
crystalhd 0000:02:00.0: Closing user[0] handle with mode 0
crystalhd 0000:02:00.0: Opening new user[0] handle
xbmc.bin: page allocation failure. order:3, mode:0x8020
Pid: 4274, comm: xbmc.bin Tainted: P            2.6.35-gentoo-r12v03 #9
Call Trace:
 [<c105ee1d>] ? __alloc_pages_nodemask+0x445/0x476
 [<c10056cb>] ? dma_generic_alloc_coherent+0x4b/0xa4
 [<c1005680>] ? dma_generic_alloc_coherent+0x0/0xa4
 [<d07d9336>] ? bc_kern_dma_alloc+0xe6/0x190 [crystalhd]
 [<d07dcb6f>] ? crystalhd_hw_setup_dma_rings+0xcf/0x210 [crystalhd]
 [<d07dcb86>] ? crystalhd_hw_setup_dma_rings+0xe6/0x210 [crystalhd]
 [<d07d9d00>] ? crystalhd_get_cmd_proc+0x500/0x14e0 [crystalhd]
 [<d07d9d00>] ? crystalhd_get_cmd_proc+0x500/0x14e0 [crystalhd]
 [<d07d7d46>] ? chd_dec_pci_suspend+0x636/0x790 [crystalhd]
 [<c106ff42>] ? page_add_new_anon_rmap+0x43/0x60
 [<d07d7ca0>] ? chd_dec_pci_suspend+0x590/0x790 [crystalhd]
 [<c1085ec9>] ? vfs_ioctl+0x1c/0x7d
 [<c1086412>] ? do_vfs_ioctl+0x443/0x47d
 [<c1019703>] ? do_page_fault+0x2cc/0x2e2
 [<c10196eb>] ? do_page_fault+0x2b4/0x2e2
 [<c121a800>] ? schedule+0x488/0x52f
 [<c1086479>] ? sys_ioctl+0x2d/0x44
 [<c100260c>] ? sysenter_do_call+0x12/0x22
 [<c1210000>] ? quirk_ich7_lpc+0x24/0x4d
Mem-Info:
DMA per-cpu:
CPU    0: hi:    0, btch:   1 usd:   0
Normal per-cpu:
CPU    0: hi:   90, btch:  15 usd:  87
active_anon:9002 inactive_anon:9795 isolated_anon:0
 active_file:16896 inactive_file:17233 isolated_file:0
 unevictable:6 dirty:3 writeback:0 unstable:0
 free:2107 slab_reclaimable:909 slab_unreclaimable:1859
 mapped:4621 shmem:19 pagetables:190 bounce:0
DMA free:988kB min:124kB low:152kB high:184kB active_anon:2024kB inactive_anon:2188kB active_file:4344kB inactive_file:5428kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:15864kB mlocked:0kB dirty:0kB writeback:0kB mapped:824kB shmem:0kB slab_reclaimable:156kB slab_unreclaimable:448kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 234 234
Normal free:7440kB min:1896kB low:2368kB high:2844kB active_anon:33984kB inactive_anon:36992kB active_file:63240kB inactive_file:63504kB unevictable:24kB isolated(anon):0kB isolated(file):0kB present:240192kB mlocked:0kB dirty:12kB writeback:0kB mapped:17660kB shmem:76kB slab_reclaimable:3480kB slab_unreclaimable:6988kB kernel_stack:1048kB pagetables:760kB unstable:0kB bounce:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0
DMA: 21*4kB 3*8kB 1*16kB 1*32kB 1*64kB 6*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 988kB
Normal: 436*4kB 358*8kB 171*16kB 3*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 7440kB
35432 total pagecache pages
1274 pages in swap cache
Swap cache stats: add 81539, delete 80265, find 20203/28160
Free swap  = 1110068kB
Total swap = 1145420kB
65279 pages RAM
2310 pages reserved
23334 pages shared
39413 pages non-shared
crystalhd 0000:02:00.0: Insufficient Memory For RX

my appletv has 256 megs of ram. i am at about 225 megs usage when playing 1080p (when crystalhd works). im going to revert to the kernel libs/module for now, unless you have some suggestions.
Comment 16 Tom Flair 2011-02-23 05:13:49 UTC
Created attachment 263595 [details]
Minor update, theoretical AppleTV support

This, with the subsequent patch, should correct one failing with the card on the AppleTV.  I don't have an AppleTV to actually *test* this on though.

There may be other differences from the OSX and linux drivers, but I believe this should address the RX error reported previously.
Comment 17 Tom Flair 2011-02-23 05:15:24 UTC
Created attachment 263597 [details, diff]
Patch for CrystalHD support

See my previous comment.  No guarantees towards its implementation.  It applies and compiles on my chroot at least.
Comment 18 h2sammo 2011-02-23 12:50:40 UTC
(In reply to comment #17)
ill give it a try in the next few days :). i run gentoo on the appletv btw, not OSX.  

Comment 19 h2sammo 2011-02-23 18:11:47 UTC
it cannot apply patch:

localhost linux # emerge crystalhd
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) x11-libs/crystalhd-9999 from unknown repo
 * Package:    x11-libs/crystalhd-9999
 * USE:  appletv elibc_glibc kernel_linux modules userland_GNU x86
 * 
 * This is a live ebuild which installs the latest from upstream's
 * git repository, and is unsupported by Gentoo.
 * Everything but bugs in the ebuild itself will be ignored.
 * 
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     2.6.36-gentoo-r5v03
>>> Unpacking source...
 * GIT update -->
 *    repository:               git://git.wilsonet.com/crystalhd.git
 *    at the commit:            2a16a74a957c3f45643a3e43380ba3f31c1301ba
 *    branch:                   master
 *    storage directory:        "/usr/portage/distfiles/git-src/crystalhd"
Cloning into /var/tmp/portage/x11-libs/crystalhd-9999/work...
done.
>>> Unpacked to /var/tmp/portage/x11-libs/crystalhd-9999/work
 * Applying crystalhd-appletv.patch ...

 * Failed Patch: crystalhd-appletv.patch !
 *  ( /usr/local/portage/x11-libs/crystalhd/files/crystalhd-appletv.patch )
 * 
 * Include in your bugreport the contents of:
 * 
 *   /var/tmp/portage/x11-libs/crystalhd-9999/temp/crystalhd-appletv.patch.out

 * ERROR: x11-libs/crystalhd-9999 failed:
 *   Failed Patch: crystalhd-appletv.patch!
 * 
 * Call stack:
 *     ebuild.sh, line   56:  Called src_unpack
 *   environment, line 4672:  Called epatch '/usr/local/portage/x11-libs/crystalhd/files/crystalhd-appletv.patch'
 *   environment, line 2194:  Called die
 * The specific snippet of code:
 *               die "Failed Patch: ${patchname}!";
 * 
 * If you need support, post the output of 'emerge --info =x11-libs/crystalhd-9999',
 * the complete build log and the output of 'emerge -pqv =x11-libs/crystalhd-9999'.
 * This ebuild is from an overlay: '/usr/local/portage/'
 * The complete build log is located at '/var/tmp/portage/x11-libs/crystalhd-9999/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/x11-libs/crystalhd-9999/temp/environment'.
 * S: '/var/tmp/portage/x11-libs/crystalhd-9999/work'

>>> Failed to emerge x11-libs/crystalhd-9999, Log file:

>>>  '/var/tmp/portage/x11-libs/crystalhd-9999/temp/build.log'

this is the requested file:  http://ompldr.org/vN2o1NA
Comment 20 Tom Flair 2011-02-23 19:17:34 UTC
Created attachment 263645 [details]
Applies AppleTV patch correctly to -9999

d'oh.  I tested the versioned build but not the -9999.   Tested both this time, applies (or not) in each case.
Comment 21 h2sammo 2011-02-23 22:24:15 UTC
still fails to play 1080p movie. this from dmesg:

kjournald starting.  Commit interval 5 seconds
EXT3-fs (hda4): mounted filesystem with writeback data mode
VFS: Mounted root (ext3 filesystem) readonly on device 3:4.
Freeing unused kernel memory: 344k freed
usb 2-1: new low speed USB device using uhci_hcd and address 2
usb 2-2: new low speed USB device using uhci_hcd and address 3
udev: starting version 151
udevd (560): /proc/560/oom_adj is deprecated, please use /proc/560/oom_score_adj instead.
Loading crystalhd v3.10.0
crystalhd 0000:02:00.0: Starting Device:0x1612
crystalhd 0000:02:00.0: enabling device (0000 -> 0002)
crystalhd 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
crystalhd 0000:02:00.0: MSI request failed..
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
crystalhd 0000:02:00.0: setting latency timer to 64
apple 0003:05AC:8241.0003: claimed by neither input, hiddev nor hidraw
apple 0003:05AC:8241.0003: hw start failed
input: Logitech USB Receiver as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.0/input/input2
logitech 0003:046D:C50C.0001: input: USB HID v1.10 Keyboard [Logitech USB Receiver] on usb-0000:00:1d.0-1/input0
logitech 0003:046D:C50C.0002: fixing up Logitech keyboard report descriptor
input: Logitech USB Receiver as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1:1.1/input/input3
logitech 0003:046D:C50C.0002: input: USB HID v1.10 Mouse [Logitech USB Receiver] on usb-0000:00:1d.0-1/input1
HDA Intel 0000:00:1b.0: enabling device (0000 -> 0002)
HDA Intel 0000:00:1b.0: PCI INT A -> GSI 22 (level, low) -> IRQ 22
HDA Intel 0000:00:1b.0: setting latency timer to 64
hda_codec: ALC889A: SKU not ready 0x400000f0
nvidia: module license 'NVIDIA' taints kernel.
Disabling lock debugging due to kernel taint
nvidia 0000:01:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
nvidia 0000:01:00.0: setting latency timer to 64
vgaarb: device changed decodes: PCI:0000:01:00.0,olddecodes=io+mem,decodes=none:owns=none
NVRM: loading NVIDIA UNIX x86 Kernel Module  260.19.29  Wed Dec  8 12:09:09 PST 2010
EXT3-fs (hda4): using internal journal
Adding 1145420k swap on /dev/hda5.  Priority:-1 extents:1 across:1145420k 
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
crystalhd 0000:02:00.0: Opening new user[0] handle
crystalhd 0000:02:00.0: Closing user[0] handle with mode 0
crystalhd 0000:02:00.0: Opening new user[0] handle
start_capture: pause_th:12, resume_th:5
crystalhd 0000:02:00.0: Firmware command T/O
crystalhd 0000:02:00.0: FwCmd Failed.
Comment 22 Tom Flair 2011-02-24 21:00:51 UTC
Created attachment 263719 [details]
Builds from a different tree

(In reply to comment #21)
This one is specifically for you. This comes from the previously mentioned repository specifically designed for use with the AppleTV.  They do include linux support, which is good since we're not interested in OSX here.  ;)

I have no idea if this will work for you, I do know that it appears to build in my chroot.  I'll try tweaking the original ebuild's USE flag to switch URIs if this works for you.

If it doesn't work for you, then it has to be something with your configuration that is getting overlooked.  The original ebuilds work fine on my AMD64 machine with a BCM70015 without any errors and perfect acceleration.

Let me know if you're successful with this one.
Comment 23 h2sammo 2011-02-27 16:56:17 UTC
it compiled perfectly and i did not need to have SMP enabled. i cannot test it however beacause for some reason i recompiled xbmc and now it does not give me the option of enabling hardware acceleration in System -> Video -> Playback... im looking into why and will let you know whether the driver crashes when used. as of now, this is the dmesg:

unloading crystalhd 0.9.27
Deleting Command context..
released api device - 253
released 18 elem
Broadcom 70012 Decoder 0000:02:00.0: PCI INT A disabled
Loading crystalhd v3.8.0
crystalhd 0000:02:00.0: Starting Device:0x1612
crystalhd 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
crystalhd 0000:02:00.0: MSI request failed..
crystalhd 0000:02:00.0: setting latency timer to 64
Comment 24 h2sammo 2011-03-09 22:21:55 UTC
ok, i solved my xbmc problem and it is now using crystalhd v.3.8.0 without crashing. i guess you can go ahead and put this appletv version into your "official" ebuild :). i will have test for a few days and report back if it uses the driver faithfully even after pausing or changing videos (which was problematic with the kernel version of crystalhd)

thank you very much
Comment 25 h2sammo 2011-03-11 13:13:39 UTC
ok i am at wits end. my wife decided the "ultimate" test is to restart the machine and once that happened, all hell broke loose again. even though the crystalhd drivers worked perfectly before the restart, now i get the same "Insufficient memory" error i used to get with the non OSX sources. 

i tried rebuilding the kernel and recompiling crystalhd several times but no change. As soon as the decoder is engaged, XBMC crashes and dmesg spits out insufficient crystalhd memory messages.

any ideas? cuz im beat
Comment 26 Tom Flair 2011-03-11 13:40:17 UTC
(In reply to comment #25)

I have similar issues with my card, but I've assumed that it's because of some glitch in my setup.  (running on a mini-PCIe to PCIe adapter on top of a riser cable)   My system doesn't recognize the card on a warm reboot.  If I power down completely then do a wakeonlan or hit the power button, it works fine.

Give that process a shot and see if it continues to work for you.  If it does, repeat each process a few times if you don't mind.  If a full power down/boot works instead of a warm reboot repeatedly, then there is either a bug in the module or something in our setup.

Alternatively, you may want to register at the XBMC forums and ask someone there.

http://forum.xbmc.org/tags.php?tag=broadcom+crystal+hd
http://forum.xbmc.org/showthread.php?t=55042
Comment 27 h2sammo 2011-03-21 12:54:28 UTC
yes, cold reboot (unplug power cord in the case of my appletv - doesnt have a power button) will have crystald hd work properly. the "reboot" command from superuser will not.

thank you
Comment 28 h2sammo 2011-03-26 01:38:33 UTC
Tom,

i read on xbmc forums and they suggest revision 156 of crystalhd for my decoder version because of crashes similar to what i observe. i tried emerging r156 with ESVN_REVISION="156" emerge crystalhd...

subversion trunk updated fine but the compilation failed. here is the build log http://ompldr.org/vN3l2bA
Comment 29 Tom Flair 2011-03-26 12:01:01 UTC
(In reply to comment #28)
> Tom,
> 
> i read on xbmc forums and they suggest revision 156 of crystalhd for my decoder
> version because of crashes similar to what i observe. i tried emerging r156
> with ESVN_REVISION="156" emerge crystalhd...
> 
> subversion trunk updated fine but the compilation failed. here is the build log
> http://ompldr.org/vN3l2bA

Hmmm... Perhaps this revision isn't compatible with 2.6.36? 

error: unknown field 'ioctl' specified in initializer
error: initialization from incompatible pointer type

I'll play with this later and see what happens.
Comment 30 h2sammo 2011-03-29 18:51:31 UTC
i tried every stable kernel available in portage. they all failed with r156. i looked here http://code.google.com/p/crystalhd-for-osx/updates/list and i tried r170, right before they went back from 8 to 16 DMA. It compiled fine and i get better results (much less to no crashes) but as warned, the r17x family drops more frames than i would like which makes a pretty choppy viewing experience at times.

i am hoping you will be able to get r156 to compile.
Comment 31 Tom Flair 2011-04-02 02:39:16 UTC
Created attachment 268175 [details]
x11-libs/crystalhd-appletv-156.ebuild

Changing the the ebuild name to reflect that this is specifically for the AppleTV units.

I cherry picked a few lines into a patch.  I can tell you that it compiles and installs, but that's it.  As before, I have no idea how it will function for you on the hardware itself.   Sorry for the delay, real life has been interesting.
Comment 32 Tom Flair 2011-04-02 02:40:47 UTC
Created attachment 268177 [details]
x11-libs/crystalhd-appletv patch to support kernel changes since r156

Patch as mentioned in the previous ebuild.
Comment 33 Tom Flair 2011-04-02 03:15:20 UTC
Created attachment 268179 [details]
x11-libs/crystalhd-20110314.ebuild

This is for every other machine out there running with a Broadcom CrystalHD BCM70012 or BCM70015.  I'm using a BCM70015 without issue and each revision I've posted on multiple kernel versions.

Rehash of what's been said before:
In hopes of getting this into portage, I'm creating snapshots of the git tree and packaging those snapshots.
git clone git://git.wilsonet.com/crystalhd.git; cd crystalhd; rm -rf .git*; tar cf /usr/portage/distfiles/crystalhd-20110314.tbz2 .

If you want to build off of the main git tree, save this as x11-libs/crystalhd-9999.ebuild and run with that.

Applications that can make use of this module:
MythTV  http://www.mythtv.org/wiki/Broadcom_Crystal_HD
FFMPEG and mplayer    http://intr.overt.org/blog/?p=125  https://github.com/philipl/mplayer-crystalhd
XBMC    http://xbmc.org/davilla/2009/12/29/broadcom-crystal-hd-its-magic/
VLC  (with v1.2)  http://forum.videolan.org/viewtopic.php?f=13&t=88782#p292894

I use this daily with MythTV and am looking forward to using mplayer and VLC with it.
Comment 34 Tom Flair 2011-04-02 19:23:15 UTC
Created attachment 268239 [details]
x11-libs/libcrystalhd-3.22.0.ebuild

Following Fedora's naming scheme and upstream's version info instead of using a datestamp.   The module and library have different version numbers, but since the module is also available in the kernel tree, I've opted to go with the library version.

All else still applies.

Sorry for the bugspam.