Denis Oliver Kropp wrote:
Quoting Claudio Ciccani via CVS:
CVSROOT: /cvs/directfb
Module name: DirectFB
Changes by: klan 20050718 18:22:58
Modified files:
systems/fbdev : Makefile.am fbdev.c fbdev.h
Log message:
The FBDev system is now responsible of retrieving the PCI Bus, Card Vendor and
Device identifiers.
These informations are stored in the FBDevShared structure.
Nice to have that centralized and not included in each driver that needs it.
One of the next tasks should be to make these and some other drivers
independent from the FBDev System. Most of the drivers should already work
with any system module that provides graphics memory and register access.
See the attached patch.
--
Regards,
Claudio Ciccani
[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb
diff -uraN DirectFB/src/core/core_system.h /home/klan/src/DirectFB/src/core/core_system.h
--- DirectFB/src/core/core_system.h 2004-11-21 00:57:55.000000000 +0100
+++ /home/klan/src/DirectFB/src/core/core_system.h 2005-07-26 10:37:58.000000000 +0200
@@ -84,6 +84,12 @@
static unsigned int
system_videoram_length();
+static void
+system_get_busid();
+
+static void
+system_get_deviceid();
+
static CoreSystemFuncs system_funcs = {
GetSystemInfo: system_get_info,
@@ -102,7 +108,9 @@
GetAccelerator: system_get_accelerator,
VideoMemoryPhysical: system_video_memory_physical,
VideoMemoryVirtual: system_video_memory_virtual,
- VideoRamLength: system_videoram_length
+ VideoRamLength: system_videoram_length,
+ GetBusID: system_get_busid,
+ GetDeviceID: system_get_deviceid
};
#define DFB_CORE_SYSTEM(shortname) \
diff -uraN DirectFB/src/core/system.c /home/klan/src/DirectFB/src/core/system.c
--- DirectFB/src/core/system.c 2004-11-21 00:57:56.000000000 +0100
+++ /home/klan/src/DirectFB/src/core/system.c 2005-07-26 10:38:52.000000000 +0200
@@ -310,3 +310,36 @@
return system_funcs->VideoRamLength();
}
+void
+dfb_system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+ int bus = -1, dev = -1, func = -1;
+
+ D_ASSERT( system_funcs != NULL );
+
+ system_funcs->GetBusID( &bus, &dev, &func );
+
+ if (ret_bus)
+ *ret_bus = bus;
+ if (ret_dev)
+ *ret_dev = dev;
+ if (ret_func)
+ *ret_func = func;
+}
+
+void
+dfb_system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id )
+{
+ unsigned int vendor_id = 0, device_id = 0;
+
+ D_ASSERT( system_funcs != NULL );
+
+ system_funcs->GetDeviceID( &vendor_id, &device_id );
+
+ if (ret_vendor_id)
+ *ret_vendor_id = vendor_id;
+ if (ret_device_id)
+ *ret_device_id = device_id;
+}
+
diff -uraN DirectFB/src/core/system.h /home/klan/src/DirectFB/src/core/system.h
--- DirectFB/src/core/system.h 2005-07-18 11:30:55.000000000 +0200
+++ /home/klan/src/DirectFB/src/core/system.h 2005-07-26 10:38:27.000000000 +0200
@@ -80,7 +80,7 @@
/*
* Increase this number when changes result in binary incompatibility!
*/
-#define DFB_CORE_SYSTEM_ABI_VERSION 7
+#define DFB_CORE_SYSTEM_ABI_VERSION 8
#define DFB_CORE_SYSTEM_INFO_NAME_LENGTH 60
#define DFB_CORE_SYSTEM_INFO_VENDOR_LENGTH 80
@@ -166,6 +166,10 @@
void* (*VideoMemoryVirtual)( unsigned int offset );
unsigned int (*VideoRamLength)();
+
+ void (*GetBusID)( int *ret_bus, int *ret_dev, int *ret_func );
+ void (*GetDeviceID)( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id );
} CoreSystemFuncs;
@@ -212,5 +216,12 @@
unsigned int
dfb_system_videoram_length();
+void
+dfb_system_get_busid( int *ret_bus, int *ret_dev, int *ret_func );
+
+void
+dfb_system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id );
+
#endif
diff -uraN DirectFB/systems/fbdev/fbdev.c /home/klan/src/DirectFB/systems/fbdev/fbdev.c
--- DirectFB/systems/fbdev/fbdev.c 2005-07-26 10:06:04.000000000 +0200
+++ /home/klan/src/DirectFB/systems/fbdev/fbdev.c 2005-07-26 10:36:25.000000000 +0200
@@ -807,6 +807,22 @@
return dfb_fbdev->shared->fix.smem_len;
}
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+ *ret_bus = dfb_fbdev->shared->pci.bus;
+ *ret_dev = dfb_fbdev->shared->pci.dev;
+ *ret_func = dfb_fbdev->shared->pci.func;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id )
+{
+ *ret_vendor_id = dfb_fbdev->shared->device.vendor;
+ *ret_device_id = dfb_fbdev->shared->device.model;
+}
+
/******************************************************************************/
static DFBResult
diff -uraN DirectFB/systems/osx/osx.c /home/klan/src/DirectFB/systems/osx/osx.c
--- DirectFB/systems/osx/osx.c 2004-12-22 10:35:49.000000000 +0100
+++ /home/klan/src/DirectFB/systems/osx/osx.c 2005-07-26 10:40:49.000000000 +0200
@@ -229,3 +229,16 @@
return 0;
}
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+ return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id )
+{
+ return;
+}
+
diff -uraN DirectFB/systems/sdl/sdl.c /home/klan/src/DirectFB/systems/sdl/sdl.c
--- DirectFB/systems/sdl/sdl.c 2004-11-21 00:57:56.000000000 +0100
+++ /home/klan/src/DirectFB/systems/sdl/sdl.c 2005-07-26 10:41:04.000000000 +0200
@@ -245,3 +245,16 @@
return 0;
}
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+ return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id )
+{
+ return;
+}
+
diff -uraN DirectFB/systems/vnc/vnc.c /home/klan/src/DirectFB/systems/vnc/vnc.c
--- DirectFB/systems/vnc/vnc.c 2005-07-15 19:33:10.000000000 +0200
+++ /home/klan/src/DirectFB/systems/vnc/vnc.c 2005-07-26 10:41:20.000000000 +0200
@@ -230,3 +230,16 @@
return 0;
}
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+ return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id )
+{
+ return;
+}
+
diff -uraN DirectFB/systems/x11/x11.c /home/klan/src/DirectFB/systems/x11/x11.c
--- DirectFB/systems/x11/x11.c 2005-07-02 09:26:57.000000000 +0200
+++ /home/klan/src/DirectFB/systems/x11/x11.c 2005-07-26 10:41:45.000000000 +0200
@@ -241,3 +241,16 @@
return 0;
}
+static void
+system_get_busid( int *ret_bus, int *ret_dev, int *ret_func )
+{
+ return;
+}
+
+static void
+system_get_deviceid( unsigned int *ret_vendor_id,
+ unsigned int *ret_device_id )
+{
+ return;
+}
+
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev