From 4eafeec960c29369982a9b15c24681a3072f491d Mon Sep 17 00:00:00 2001 From: Jeff Hartmann Date: Wed, 18 Jul 2001 21:02:58 +0000 Subject: Add module version name at a lower layer of the code, allows things to be more flexible and allow older module versions to still work. Might not be final code if we move over to DRI kernel module version, but will be if we use XFree86 version. + Only build tdfx.o instead of tdfx-4_1_0.o since tdfx.o has never changed its API. --- libdrm/xf86drm.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'libdrm/xf86drm.c') diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index a04cf7ae..6a4c5924 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -285,10 +285,32 @@ static int drmOpenByName(const char *name) #if !defined(XFree86Server) return -1; #else + char temp_name[256]; + Bool kernel_loaded = FALSE; + + sprintf(temp_name, "%s-%d_%d_%d", name, + XF86_VERSION_MAJOR, + XF86_VERSION_MINOR, + XF86_VERSION_PATCH); + + /* first try and load the XF Version number of the module */ + if (!xf86LoadKernelModule(temp_name)) { + ErrorF("[drm] failed to load kernel module \"%s\"\n", + temp_name); + ErrorF("[drm] falling back to older kernel modules\n"); + } else { + kernel_loaded = TRUE; + } + + /* When we have more releases, add logic here to attempt to load them + * here. + */ + /* try to load the kernel module now */ - if (!xf86LoadKernelModule(name)) { + if (kernel_loaded == FALSE && !xf86LoadKernelModule(name)) { ErrorF("[drm] failed to load kernel module \"%s\"\n", name); + ErrorF("[drm] No suitable kernel module found.\n"); return -1; } #endif -- cgit v1.2.3