is ok to be shared, it will be passive on BSD.
int new);
int (*kernel_context_switch_unlock) (struct drm_device * dev);
int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence);
+ int (*dri_library_name) (struct drm_device * dev, char * buf);
/**
* Called by \c drm_device_is_agp. Typically used to determine if a
char *name);
extern void drm_sysfs_destroy(struct drm_sysfs_class *cs);
extern struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,
+ drm_head_t * head,
dev_t dev,
struct device *device,
const char *fmt, ...);
}
head->dev_class = drm_sysfs_device_add(drm_class,
- MKDEV(DRM_MAJOR,
- minor),
- DRM_PCI_DEV(dev->pdev),
- "card%d", minor);
+ head, MKDEV(DRM_MAJOR, minor),
+ DRM_PCI_DEV(dev->pdev),
+ "card%d", minor);
if (IS_ERR(head->dev_class)) {
printk(KERN_ERR
"DRM: Error sysfs_device_add.\n");
#include <linux/kdev_t.h>
#include <linux/err.h>
+#include "drmP.h"
#include "drm_core.h"
struct drm_sysfs_class {
class_unregister(&cs->class);
}
+static ssize_t show_dri(struct class_device *class_device, char *buf)
+{
+ drm_device_t * dev = ((drm_head_t *)class_get_devdata(class_device))->dev;
+ if (dev->driver->dri_library_name)
+ return dev->driver->dri_library_name(dev, buf);
+ return snprintf(buf, PAGE_SIZE, "%s\n", dev->driver->pci_driver.name);
+}
+
+static struct class_device_attribute class_device_attrs[] = {
+ __ATTR(dri_library_name, S_IRUGO, show_dri, NULL),
+};
+
/**
* drm_sysfs_device_add - adds a class device to sysfs for a character driver
* @cs: pointer to the struct drm_sysfs_class that this device should be registered to.
* Note: the struct drm_sysfs_class passed to this function must have previously been
* created with a call to drm_sysfs_create().
*/
-struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs, dev_t dev,
- struct device *device,
- const char *fmt, ...)
+struct class_device *drm_sysfs_device_add(struct drm_sysfs_class *cs,
+ drm_head_t * head, dev_t dev,
+ struct device *device, const char *fmt, ...)
{
va_list args;
struct simple_dev *s_dev = NULL;
- int retval;
+ int i, retval;
if ((cs == NULL) || (IS_ERR(cs))) {
retval = -ENODEV;
list_add(&s_dev->node, &simple_dev_list);
spin_unlock(&simple_dev_list_lock);
+ class_set_devdata(&s_dev->class_dev, head);
+
+ for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
+ class_device_create_file(&s_dev->class_dev, &class_device_attrs[i]);
+
return &s_dev->class_dev;
- error:
+error:
kfree(s_dev);
return ERR_PTR(retval);
}
void drm_sysfs_device_remove(dev_t dev)
{
struct simple_dev *s_dev = NULL;
- int found = 0;
+ int i, found = 0;
spin_lock(&simple_dev_list_lock);
list_for_each_entry(s_dev, &simple_dev_list, node) {
if (found) {
list_del(&s_dev->node);
spin_unlock(&simple_dev_list_lock);
+
+ for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
+ class_device_remove_file(&s_dev->class_dev, &class_device_attrs[i]);
+
class_device_unregister(&s_dev->class_dev);
} else {
spin_unlock(&simple_dev_list_lock);
return 0;
}
+static int dri_library_name(struct drm_device * dev, char * buf)
+{
+ return snprintf(buf, PAGE_SIZE, "i830\n");
+}
+
static struct pci_device_id pciidlist[] = {
i810_PCI_IDS
};
.dma_quiescent = i810_driver_dma_quiescent,
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,
+ .dri_library_name = dri_library_name,
.postinit = postinit,
.version = version,
.ioctls = i810_ioctls,
return 0;
}
+static int dri_library_name(struct drm_device * dev, char * buf)
+{
+ drm_radeon_private_t *dev_priv = dev->dev_private;
+ int family = dev_priv->flags & CHIP_FAMILY_MASK;
+
+ return snprintf(buf, PAGE_SIZE, "%s\n",
+ (family < CHIP_R200) ? "radeon" :
+ ((family < CHIP_R300) ? "r200" :
+ "r300"));
+}
+
static struct pci_device_id pciidlist[] = {
radeon_PCI_IDS
};
.pretakedown = radeon_driver_pretakedown,
.open_helper = radeon_driver_open_helper,
.vblank_wait = radeon_driver_vblank_wait,
+ .dri_library_name = dri_library_name,
.irq_preinstall = radeon_driver_irq_preinstall,
.irq_postinstall = radeon_driver_irq_postinstall,
.irq_uninstall = radeon_driver_irq_uninstall,
return 0;
}
+static int dri_library_name(struct drm_device * dev, char * buf)
+{
+ return snprintf(buf, PAGE_SIZE, "unichrome\n");
+}
+
static struct pci_device_id pciidlist[] = {
viadrv_PCI_IDS
};
.irq_uninstall = via_driver_irq_uninstall,
.irq_handler = via_driver_irq_handler,
.dma_quiescent = via_driver_dma_quiescent,
+ .dri_library_name = dri_library_name,
.reclaim_buffers = drm_core_reclaim_buffers,
.get_map_ofs = drm_core_get_map_ofs,
.get_reg_ofs = drm_core_get_reg_ofs,