# driver porting patching installation



## richs-lxh (May 9, 2010)

Hi everybody, I really hope this is the right place to post, so here goes.

I'm an experienced Linux user, but  *BSD n00b, so og easy on me 

I'm trying to solve a Sis graphic card issue on BSD, (there is a fix for Linux).

After spending a week or so hacking and Googling, I'm not making any progress, soooooo.

How would I go about porting, patching, installing a Linux graphic driver?

I was reading this message:
http://markmail.org/message/3ugjkfhav2jn5c2m

Linux has an updated xorg sis graphic driver which has been patched to solve a nasty colour depth problem. This problem can also be fixed with the sisfb framebuffer (not available for Freebsd).
There are also othe xorg.conf edits which work on lInux, but so far nothing seems to work on FreeBSD:
http://sites.google.com/site/superpikmaster/sis

So as i'm running out of options, I was wondering if somebody could give me any advice.

1. Can I apply a Linux patch to FreeBSD?
2. Can I install the new Linux Sis driver on my FreeBSD driven laptop?
3. Would it be easy to port the newer driver?

*4.* Any *Sis-using* FreeBSD users here who have found a fix or workaround? 
On mailing lists and forums it's common for Ati/Nvidia users to offer up typical xorg/xserver advice without actually ever having used a Sis card. Just so I make it clear that I have Googled practically every sis releated site/blog/forum and have tried many many fixes. 

As I have said, this isn't a problem for me on Linux, only FreeBSD. I have FreeBSD on my other (Ati driven) 64bit laptop, and it works perfectly, but I would like to find a Sis solution if there is one, for this laptop.

Thanks in advance for any hints, tips, guides, links, advice. I'm even up for some RTFM as long as you provide me a link to a (up-to-date) manual


----------



## wblock@ (May 9, 2010)

richs-lxh said:
			
		

> Hi everybody, I really hope this is the right place to post, so here goes.
> 
> How would I go about porting, patching, installing a Linux graphic driver?



The Porters Handbook is the place to start.  Well, that and looking at some of the existing ports as examples.  And the freebsd-ports mailing list.



> I was reading this message:
> http://markmail.org/message/3ugjkfhav2jn5c2m
> 
> Linux has an updated xorg sis graphic driver which has been patched to solve a nasty colour depth problem. This problem can also be fixed with the sisfb framebuffer (not available for Freebsd).
> ...



Kernel patch, no, Linux and FreeBSD are totally different there.  But patches to applications or non-kernel drivers often work.  xorg video drivers are a mixed deal because Linux now has some that run in the kernel and FreeBSD does not.



> 2. Can I install the new Linux Sis driver on my FreeBSD driven laptop?



If it compiles and runs, and doesn't require anything not provided by FreeBSD or xorg on FreeBSD.



> 3. Would it be easy to port the newer driver?



Maybe easy if you're familiar with other xorg drivers.  I just had a look at that driver, but didn't get it to compile.  Sometimes the quick hack of copying an existing port--like xf86-video-sis in this case--and hacking it to use the different distfile is easy.  But I think this sis-imedia driver is not very related.



> *4.* Any *Sis-using* FreeBSD users here who have found a fix or workaround?



And that's a difficulty.  Few people seem to have that particular SIS hardware, fewer still trying to run xorg on it, even less on FreeBSD.

Someone was asking about this or a similar SIS board on one of the mailing lists not all that long ago.  I'd suggest posting to the freebsd-x11 mailing list with the goal of making a port of that driver.  I can offer a little help, but I'm not really familiar with the xorg ports.  Still, it's a way to learn...


----------



## richs-lxh (May 9, 2010)

Hi wblock,
Thanks for such a detailed reply, I am looking through the Porter's Handbook now. 
I think that going for getting the sisfb framebuffer to be available for FreeBSD would be the way to go (if it's possible, i'm on new ground here).
I'm not very familiar with the FreeBSD kernel or how modules are compiled, but it should be possible.
Then failing that, maybe trying to patch the driver itself.

I know it may seem like a bit of a lost cause for crap hardware, but there is also a "challenge" element, just getting something to work.

My other systems were chosen for hardware compatibility (Ati/Nvidia/Atheros), but this laptop was given to me. And although it's old and has PITA hardware, it's my main machine for work and networking related tasks. It doesn't need a heap of power or fancy 3D accelerated graphics, but not even having vesa or basic sis drivers working is a bit sad.

I'm off to read up, and I may even risk the FreeBSD mailing lists.

Thanks again.


----------



## wblock@ (May 9, 2010)

An interesting Mandriva thread with a pointer to sis671 driver source on Ubuntu: http://forum.mandriva.com/viewtopic.php?t=91810&start=75

That source is easy enough to hack into a port.  It still fails to build because it wants a pciVideoPtr, which AFAIK is obsolete.  That's the reason the stock xf86-video-sis-intel driver is marked Ignore.

At this point, I'd suggest checking with the xorg group: http://lists.freedesktop.org/mailman/listinfo/xorg


----------



## wblock@ (May 10, 2010)

And for completeness, here are guidelines on converting old drivers that want pciVideoPtr to the new libpciaccess system: http://www.x.org/wiki/PciReworkHowto


----------



## richs-lxh (May 10, 2010)

Hi wblock,
Thanks for the links.

I am running FreeBSD 8 and was looking at the Sis driver in Current (9) ports. I used portsnap to update my ports thinking I would get that version:
ftp://ftp.freebsd.org/pub/FreeBSD/p...rrent/x11-drivers/xf86-video-sis-0.10.1_3.tbz

However, when I cd'd to /usr/ports, I got offered:
ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/x11-drivers/xf86-video-sis-0.10.2.tbz

The funny thing is, when I tried to install the earlier 10.1.3 driver manually with pkg_add, it asked for newer dependencies than my system has, even though it's older.

I was hoping that I could try the different driver before diving into something more complicated.

I also found contact information from FreshPorts:
http://www.freshports.org/x11-drivers/xf86-video-sis/

So I may ask a few more questions before trying to do something that may be out of my depth.


----------



## SirDice (May 10, 2010)

richs-lxh said:
			
		

> I am running FreeBSD 8 and was looking at the Sis driver in Current (9) ports.


There is only one (1) ports tree.


----------



## richs-lxh (May 10, 2010)

I have just found out something rather amazing (for me). I just installed the Debian sid Sis 10.2-*3* on my Crucnhbang install (Debian Squeeze), with no newer dependencies needed. I removed the video=sisfb argument from Grub and booted into a nice shiny, perfect colour-depth desktop. No more need for the sisfb framebuffer.

This means the bug has been fixed in xserver-xorg-video-sis-1_0.10.2-3 !!

To say i'm overjoyed is an understatement. If I can get my hands on a FreeBSD port/update of that version, my FreeBSD install will be perfect.

I don't suppose there is an "unstable" repo for FreeBSD like Debian sid, or a way to get my hands on that driver?

I have only been using FreeBSD a week, so I still think like a Linux user, sorry for that. Just trying find solutions.


----------



## phoenix (May 10, 2010)

Update your ports tree, and install /usr/ports/x11-drivers/xf86-video-sis.  That's version 0.10.2.


----------



## wblock@ (May 10, 2010)

phoenix said:
			
		

> Update your ports tree, and install /usr/ports/x11-drivers/xf86-video-sis.  That's version 0.10.2.



0.10.2_1 as of this morning; rnoland checked in one patch that allows it to work with a couple of additional chipsets.  richs-lxh, for next time, use `# pciconf -lv` and `# dmesg` to identify exactly which hardware is in question.


----------



## richs-lxh (May 11, 2010)

Well up until last night, version 10.2 still had the bug. I emailed the FreeBSD/Xorg mailing list regarding the availability of a newer driver which Debian had in the sid repos, and they emailed me back within a couple of hours regarding an update. I was amazed !!

The new 10.2-1 is now in the repos, and yes, it works perfectly. No more bad colour-depth blotches.

I am over the moon with FreeBSD, and the community.


----------

