[PATCH] xfree86: add nouveau as the first automatic driver for NVIDIA hardware

Anssi Hannula anssi.hannula at iki.fi
Wed Apr 20 04:34:52 PDT 2011


On 20.04.2011 06:28, Peter Hutterer wrote:
> On Wed, Apr 20, 2011 at 05:38:35AM +0300, Anssi Hannula wrote:
>> Add nouveau as the first driver on Linux for NVIDIA hardware when
>> driver autoconfiguration is done, as it is more capable than nv.
>>
>> nv is also kept in the list as it is more widely supported and because
>> some old cards are not supported by nouveau.
>>
>> Signed-off-by: Anssi Hannula <anssi.hannula at iki.fi>
>> ---
>>
>> Alan Coopersmith wrote:
>>> You seem to have lost the #ifdef __linux__ from last month's version
>>> of this patch:
>>>
>>> http://patchwork.freedesktop.org/patch/4579/
>>
>> Ah, didn't notice that one, sorry. Here's the patch again with that
>> one added.
>>
>>
>>  hw/xfree86/common/xf86pciBus.c |    7 ++++++-
>>  1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> diff --git a/hw/xfree86/common/xf86pciBus.c b/hw/xfree86/common/xf86pciBus.c
>> index 447b192..4c1b35e 100644
>> --- a/hw/xfree86/common/xf86pciBus.c
>> +++ b/hw/xfree86/common/xf86pciBus.c
>> @@ -1123,7 +1123,12 @@ videoPtrToDriverList(struct pci_device *dev,
>>  	    break;
>>  	case 0x102b:		    driverList[0] = "mga";	break;
>>  	case 0x10c8:		    driverList[0] = "neomagic"; break;
>> -	case 0x10de: case 0x12d2:   driverList[0] = "nv";	break;
>> +	case 0x10de: case 0x12d2:
>> +#ifdef __linux__
>> +	    driverList[0] = "nouveau"; driverList[1] = "nv"; break;
>> +#else
>> +	    driverList[0] = "nv"; break;
>> +#endif
>>  	case 0x1106:		    driverList[0] = "openchrome"; break;
>>          case 0x1b36:		    driverList[0] = "qxl"; break;
>>  	case 0x1163:		    driverList[0] = "rendition"; break;
>> -- 
>> 1.7.3
> 
> bikeshedding: how about this style below? I find it easier to read (not a
> big fan of if and else containing the same statements where not necessary).
> 
> {
>         int idx = 0;
> #ifdef __linux__
>         driverList[idx++] = "nouveau";
> #endif
>         driverList[idx++] = "nv";
>         break;
> }

Heh, I thought of that but decided not to do it as it would be so
different from the rest of the entries. In any case, attached is the
patch using that style.

-- 
Anssi Hannula


More information about the xorg-devel mailing list