My words on free/open source software

Saturday, September 20, 2008

Fix nVidia's Proprietary Driver's Poor 2D Performance on Linux

Call me a fool. I bought an XFX GeForce FX 5200 PCI for my workstation (which is actually a Dell SC440 tower server who has no AGP slot). And nVidia's poor proprietary driver is notorious slow of 2D on Linux. The CPU usage of the Xorg process easily goes up to around 70% on my Xeon Core 2 @ 1.86GHz even when scrolling the text in gnome-terminal, not to say reading web pages in Firefox, which slows down everything else. And I've been sticking to a years old pristine GNOME (2.14 shipped with Debian 4.0 Etch) with nothing eye-candy here.

Finally I've found a workaround: http://www.nvnews.net/vbulletin/showpost.php?p=1704073&postcount=1: Update (2008-07-18) worked for me. In courtesy of xsolarwindx.

The improvement: now with this little fix the time used to build an Linux kernel on my workstation is only half as before just because the little baby likes writing its progress onto the terminal and old nVidia hates this so it made the displaying of text even more time-consuming than compiling the multi-million-line kernel itself!

I've been running nVidia's driver 173.14.12 x86_64 on a stock Debian 4.0 Etchnhalf kernel (2.6.24-etchnhalf.1-amd64).

I'll never buy an nVidia unless they released full GPL drivers.

Sunday, September 14, 2008

Install ATI's fglrx Catalyst 8.8 Driver (v 8.522) on Linux 2.6.27

The Linux kernel 2.6.27 has changed an API (smp_call_function()) that breaks compilation of ATI's Catalyst 8.8 fglrx driver. You get error like this:


/usr/src/fglrx-8.522/firegl_public.c:3080:50: error: macro "smp_call_function" passed 4 arguments, but takes just 3
/usr/src/fglrx-8.522/firegl_public.c: In function ‘__ke_flush_cache’:
/usr/src/fglrx-8.522/firegl_public.c:3080: error: ‘smp_call_function’ undeclared (first use in this function)
/usr/src/fglrx-8.522/firegl_public.c:3080: error: (Each undeclared identifier is reported only once
/usr/src/fglrx-8.522/firegl_public.c:3080: error: for each function it appears in.)
...


Loïc Minier has made a patch for Catalyst 8.7, and I've adapted it to Catalyst 8.8:

From 42a6390f599294c60a4960b0a6cd4e399b1a81ee Mon Sep 17 00:00:00 2001
From: Yan Li
Date: Sun, 14 Sep 2008 17:45:48 +0800
Subject: [PATCH] patch for building on 2.6.27

ref: http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/6086b1cb7674fc43
---
firegl_public.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/firegl_public.c b/firegl_public.c
index bdc94b2..d85a567 100644
--- a/firegl_public.c
+++ b/firegl_public.c
@@ -202,6 +202,13 @@
#define preempt_enable()
#endif

+/* Since 2.6.27 smp_call_function doesn't have a nonatomic/retry argument */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
+#define SMP_CALL_FUNCTION(func, info, retry, wait) smp_call_function(func, info, wait)
+#else
+#define SMP_CALL_FUNCTION(func, info, retry, wait) smp_call_function(func, info, retry, wait)
+#endif
+
// ============================================================
/* globals */

@@ -3077,7 +3084,7 @@ int ATI_API_CALL __ke_flush_cache(void)
{
#ifdef __SMP__
/* write back invalidate all other CPUs (exported by kernel) */
- if (smp_call_function(deferred_flush, NULL, 1, 0) != 0)
+ if (SMP_CALL_FUNCTION(deferred_flush, NULL, 1, 0) != 0)
panic("timed out waiting for the other CPUs!\n");

/* invalidate this CPU */
@@ -4796,7 +4803,7 @@ struct _agp_memory* ATI_API_CALL __ke_agp_allocate_memory_phys_list(
void ATI_API_CALL KCL_CallFuncOnOtherCpus(firegl_void_routine_t func_to_call)
{
#ifdef CONFIG_SMP
- smp_call_function( firegl_smp_func_parameter_wrap, (void*)func_to_call, 0, 1 );
+ SMP_CALL_FUNCTION( firegl_smp_func_parameter_wrap, (void*)func_to_call, 0, 1 );
#endif
}

@@ -4910,7 +4917,7 @@ static int ATI_API_CALL KCL_enable_pat(unsigned int save_orig_pat)
}

#ifdef CONFIG_SMP
- if (smp_call_function(KCL_setup_pat, NULL, 0, 1) != 0)
+ if (SMP_CALL_FUNCTION(KCL_setup_pat, NULL, 0, 1) != 0)
return 0;
#endif
KCL_setup_pat(NULL);
@@ -4929,7 +4936,7 @@ static void ATI_API_CALL KCL_disable_pat(void)
}

#ifdef CONFIG_SMP
- if (smp_call_function(KCL_restore_pat, NULL, 0, 1) != 0)
+ if (SMP_CALL_FUNCTION(KCL_restore_pat, NULL, 0, 1) != 0)
return;
#endif
KCL_restore_pat(NULL);
--
1.5.4.3


I suggest use the --buildpkg function of the ATI driver to build packages for your system. Those packages use dkms to build the kernel module needed. (For Debian/Ubuntu flavor Linux, I suggest use the way as described in https://help.ubuntu.com/community/BinaryDriverHowto/ATI.) Apply the above patch after installed the fglrx-kernel-source.*.deb to /var/lib/dkms/fglrx/8.522/source, then run "sudo dkms build -m fglrx -v 8.522" to build the kernel module.

Reference:
http://groups.google.com/group/linux.debian.bugs.dist/browse_thread/thread/6086b1cb7674fc43

About Me

My photo
Santa Cruz, California, United States