crystalhd
crystalhd copied to clipboard
check_mem_region doesn't exist in Kernel 4
I was trying to compile this on kernel 4.1 with gcc 4.9 and got the following error:
/home/nticompass/Code/crystalhd/driver/linux/crystalhd_lnx.c: In function ‘chd_pci_reserve_mem’:
/home/nticompass/Code/crystalhd/driver/linux/crystalhd_lnx.c:541:2: error: implicit declaration of function ‘check_mem_region’ [-Werror=implicit-function-declaration]
rc = check_mem_region(bar0, i2o_len);
^
I know nothing about C, nor about writing Linux drivers, but would just removing the call to check_mem_region
fix it, or is more work required?
@NTICompass I'm in the same boat as you but from a bit of research I think it's OK to comment out the if block that references that. It was removed from the kernel because it was racy - between checking the memory and doing the ioremap something else could have grabbed it.
For full correctness it should probably be changed to request_mem_region before the iomap - I'll try and do a PR for this tomorrow, but it should work without it.
I figured I'd try to test this out on my own. I commented out the check_mem_region
calls, which let it actually compile! I then launched vlc --codec crystalhd video.mp4
and mpv --vd=lavc:h264_crystalhd
and it works! :-)
Just out of curiousity, how do you identify the driver running? I've compiled successfully, but in dmesg output there's no message that CrystalHD started decoding. Do I have to compile VLC myself?
Using ubuntu 14.04 x64.
I'm running Debian 8, and I see in dmesg
that the driver is loaded on boot and running/decoding when I use mpv or vlc. I installed mpv and vlc from http://deb-multimedia.org, so they may be different builds from what's in Debian's (or Ubuntu's) default repo.
I don't remember the exact steps I used to install the driver, but I know I see messages in dmesg
. I did take notes about the install process and when I get home and get my notebook, I can explain my process.
@NTICompass Thank you! I'm waiting for your reply then. One of the reasons I'm sticking with Ubuntu LTS is that I couldn't compile the driver on Debian 8.
The thing is that, the driver is installed and loaded, but with the old driver, it used to announce it's decoding, but I can't see it so I'm not sure if it's actually running. I can see driver is loaded, but I am not sure whether it's decoding.
I do have kernel 4.1 (and I think gcc-4.9) installed from jessie-backports. The stable (non-backports) kernel didn't work with my machine's video card. When I get back home, I'll see what I have written in my notebook about how I installed it.
Maybe I'll even fork this repo and hack up my own README, I'll see.
@NTICompass could you test my updates - I'm getting errors due to gcc 5.1 I suspect - will work on these tonight.
The code is https://github.com/dbason/crystalhd
@Ardakilic: Besides the driver and libcrystalhd, you also need the firmware installed (apt-get install firmware-crystalhd
should do it).
I installed libcrystalhd3
and firmware-crystalhd
from Debian, and the driver from this repo and it works fine for me.
When it's decoding, you should see something like crystalhd 0000:03:00.0: Opening new user[0] handle
.
@dbason: I'll try to test that tomorrow or Friday when I get a chance. Though I'm not sure if I can get gcc-5.1 on Debian 8.
@NTICompass Thank you! Indeed I didn't install firmware-crystalhd
in addition to drivers. I'll check this evening :) I'll let you guys know.
@NTICompass the changes I've made should work on gcc 4.9, but I haven't fixed gcc 5.1 issues yet. I can compile that file but because I've only got gcc 5.1 I can't compile the rest and check the driver actually works. If you can compile it with 4.9 and check it runs OK that would be awesome.
Actually don't worry, it compiles but throws errors on load. Need to do more debugging
Edit: so yeah I don't really know what I'm doing. I think pci_request_regions is reserving the same regions. I'm going to refactor the code and switch out the ioremap_nocache for pci_ioremap_bar which I think is the more correct way to do it. I'll test it out and then reopen my PR (although I'm not sure if the maintainer of this repo is actually active anymore).
Edit2: All sorted now, and compiles with the latest version of GCC
@dbason, your fork is working very well for me on Xubuntu 16.04 with kernel 4.4.0. It's great to be able to play 1080p video on an old Atom Nettop :+1:.
Awesome to hear!
Very late catch-up:
@dbason 's fork compiled successfully on Lubuntu 16.04 with 4.4.x kernel, and I can use BCM70015 along with VLC and Gnome Mplayer successfully. Shame that Kodi and Plex removed support on recent versions.