Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_mem_region doesn't exist in Kernel 4 #2

Open
NTICompass opened this issue Sep 17, 2015 · 15 comments
Open

check_mem_region doesn't exist in Kernel 4 #2

NTICompass opened this issue Sep 17, 2015 · 15 comments

Comments

@NTICompass
Copy link
Contributor

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?

@dbason
Copy link
Contributor

dbason commented Sep 30, 2015

@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.

@NTICompass
Copy link
Contributor Author

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! :-)

@Ardakilic
Copy link

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.

@NTICompass
Copy link
Contributor Author

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.

@Ardakilic
Copy link

@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.

@NTICompass
Copy link
Contributor Author

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.

@dbason
Copy link
Contributor

dbason commented Sep 30, 2015

@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

@NTICompass
Copy link
Contributor Author

@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.

@NTICompass
Copy link
Contributor Author

@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.

@Ardakilic
Copy link

@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.

@dbason
Copy link
Contributor

dbason commented Oct 1, 2015

@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.

@dbason
Copy link
Contributor

dbason commented Oct 2, 2015

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

@dlenski
Copy link
Contributor

dlenski commented May 6, 2016

@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 👍.

@dbason
Copy link
Contributor

dbason commented May 6, 2016

Awesome to hear!

@Ardakilic
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants