On Thu, 2009-01-29 at 23:58 +0100, Thomas Hellström wrote: > Hmm, > Wasn't this at some point intended for server-free operation?
I think that was John Smirls intention when he added it but it's the wrong approach. > Anyway, dri_library_name is misleading since there are other dri clients > than OpenGL... This is one reason, it doesn't scale. Should we have mesa_library_name, cairo_drm_driver_name, xorg_driver_name, xvmc_driver_name sysfs files? And for different chipsets the drivers will break into different .so files. One driver type may cover all of intel in one driver (like the ddx driver), other drivers may need different drivers for different intel chipsets (like mesa). So the kernel needs to know how to map the current PCI_ID to a specific driver... for every driver type we may add (we may not add a lot of driver types, though, but that doesn't make the sysfs file ok). What the kernel does, as I write in the commit message, is to extract the PCI_ID -> kernel module map from the modules and then build up a map from all PCI_ID the kernel supports to the module name in a text file in /lib/modules. We can do a similar thing for standalone GL, by extracting PCI_IDs from the mesa drivers and creating a map from PCI ID to mesa driver name. Then when you're initializing you EGL driver you get the PCI ID for the device [1], figure out which driver to load and you're good. Or you can do it in a number of other ways, the point is that it's *not* the kernels jobs to track this. cheers, Kristian [1] Could be done like this: http://cgit.freedesktop.org/~krh/eagle/tree/eagle.c#n249 > /Thomas > > > Kristian Høgsberg wrote: > > Hey; comments on this? Can we put it in one of the git tree so it > > doesn't fall through the cracks? It's pretty harmless and could be > > merged for the 2.6.29 kernel, or we could push it the the next merge > > window if it's not suitable for the rc phase. Either way, we need to > > squash this. > > > > cheers, > > Kristian > > > > On Mon, Jan 5, 2009 at 4:10 PM, Kristian Høgsberg <k...@redhat.com> wrote: > > > >> The kernel shouldn't be in the business of telling user space which > >> driver to load. The kernel defers mapping PCI IDs to module names > >> to user space and we should do the same for DRI drivers. > >> > >> And in fact, that's how it does work today. Nothing uses the > >> dri_library_name attribute, and the attribute is in fact broken. > >> For intel devices, it falls back to the default behaviour of returning > >> the kernel module name as the DRI driver name, which doesn't work for > >> i965 devices. Nobody has ever hit this problem or filed a bug about this. > >> > >> Signed-off-by: Kristian Høgsberg <k...@redhat.com> > >> --- > >> drivers/gpu/drm/drm_sysfs.c | 29 ----------------------------- > >> drivers/gpu/drm/radeon/radeon_drv.c | 12 ------------ > >> drivers/gpu/drm/via/via_drv.c | 6 ------ > >> include/drm/drmP.h | 1 - > >> 4 files changed, 0 insertions(+), 48 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c > >> index 65d72d0..f922c0b 100644 > >> --- a/drivers/gpu/drm/drm_sysfs.c > >> +++ b/drivers/gpu/drm/drm_sysfs.c > >> @@ -118,20 +118,6 @@ void drm_sysfs_destroy(void) > >> class_destroy(drm_class); > >> } > >> > >> -static ssize_t show_dri(struct device *device, struct device_attribute > >> *attr, > >> - char *buf) > >> -{ > >> - struct drm_minor *drm_minor = to_drm_minor(device); > >> - struct drm_device *drm_dev = drm_minor->dev; > >> - if (drm_dev->driver->dri_library_name) > >> - return drm_dev->driver->dri_library_name(drm_dev, buf); > >> - return snprintf(buf, PAGE_SIZE, "%s\n", > >> drm_dev->driver->pci_driver.name); > >> -} > >> - > >> -static struct device_attribute device_attrs[] = { > >> - __ATTR(dri_library_name, S_IRUGO, show_dri, NULL), > >> -}; > >> - > >> /** > >> * drm_sysfs_device_release - do nothing > >> * @dev: Linux device > >> @@ -474,7 +460,6 @@ void drm_sysfs_hotplug_event(struct drm_device *dev) > >> int drm_sysfs_device_add(struct drm_minor *minor) > >> { > >> int err; > >> - int i, j; > >> char *minor_str; > >> > >> minor->kdev.parent = &minor->dev->pdev->dev; > >> @@ -496,18 +481,8 @@ int drm_sysfs_device_add(struct drm_minor *minor) > >> goto err_out; > >> } > >> > >> - for (i = 0; i < ARRAY_SIZE(device_attrs); i++) { > >> - err = device_create_file(&minor->kdev, &device_attrs[i]); > >> - if (err) > >> - goto err_out_files; > >> - } > >> - > >> return 0; > >> > >> -err_out_files: > >> - if (i > 0) > >> - for (j = 0; j < i; j++) > >> - device_remove_file(&minor->kdev, &device_attrs[j]); > >> device_unregister(&minor->kdev); > >> err_out: > >> > >> @@ -523,9 +498,5 @@ err_out: > >> */ > >> void drm_sysfs_device_remove(struct drm_minor *minor) > >> { > >> - int i; > >> - > >> - for (i = 0; i < ARRAY_SIZE(device_attrs); i++) > >> - device_remove_file(&minor->kdev, &device_attrs[i]); > >> device_unregister(&minor->kdev); > >> } > >> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c > >> b/drivers/gpu/drm/radeon/radeon_drv.c > >> index 71af746..971f380 100644 > >> --- a/drivers/gpu/drm/radeon/radeon_drv.c > >> +++ b/drivers/gpu/drm/radeon/radeon_drv.c > >> @@ -41,17 +41,6 @@ int radeon_no_wb; > >> MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); > >> module_param_named(no_wb, radeon_no_wb, int, 0444); > >> > >> -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 & RADEON_FAMILY_MASK; > >> - > >> - return snprintf(buf, PAGE_SIZE, "%s\n", > >> - (family < CHIP_R200) ? "radeon" : > >> - ((family < CHIP_R300) ? "r200" : > >> - "r300")); > >> -} > >> - > >> static int radeon_suspend(struct drm_device *dev, pm_message_t state) > >> { > >> drm_radeon_private_t *dev_priv = dev->dev_private; > >> @@ -95,7 +84,6 @@ static struct drm_driver driver = { > >> .get_vblank_counter = radeon_get_vblank_counter, > >> .enable_vblank = radeon_enable_vblank, > >> .disable_vblank = radeon_disable_vblank, > >> - .dri_library_name = dri_library_name, > >> .irq_preinstall = radeon_driver_irq_preinstall, > >> .irq_postinstall = radeon_driver_irq_postinstall, > >> .irq_uninstall = radeon_driver_irq_uninstall, > >> diff --git a/drivers/gpu/drm/via/via_drv.c b/drivers/gpu/drm/via/via_drv.c > >> index 0993b44..bc2f518 100644 > >> --- a/drivers/gpu/drm/via/via_drv.c > >> +++ b/drivers/gpu/drm/via/via_drv.c > >> @@ -28,11 +28,6 @@ > >> > >> #include "drm_pciids.h" > >> > >> -static int dri_library_name(struct drm_device *dev, char *buf) > >> -{ > >> - return snprintf(buf, PAGE_SIZE, "unichrome"); > >> -} > >> - > >> static struct pci_device_id pciidlist[] = { > >> viadrv_PCI_IDS > >> }; > >> @@ -52,7 +47,6 @@ static struct drm_driver driver = { > >> .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, > >> .reclaim_buffers_locked = NULL, > >> .reclaim_buffers_idlelocked = via_reclaim_buffers_locked, > >> diff --git a/include/drm/drmP.h b/include/drm/drmP.h > >> index 7802c80..63a1bb3 100644 > >> --- a/include/drm/drmP.h > >> +++ b/include/drm/drmP.h > >> @@ -682,7 +682,6 @@ struct drm_driver { > >> int (*kernel_context_switch) (struct drm_device *dev, int old, > >> int new); > >> void (*kernel_context_switch_unlock) (struct drm_device *dev); > >> - int (*dri_library_name) (struct drm_device *dev, char *buf); > >> > >> /** > >> * get_vblank_counter - get raw hardware vblank counter > >> -- > >> 1.6.1 > >> > >> > >> ------------------------------------------------------------------------------ > >> -- > >> _______________________________________________ > >> Dri-devel mailing list > >> Dri-devel@lists.sourceforge.net > >> https://lists.sourceforge.net/lists/listinfo/dri-devel > >> > >> > > > > ------------------------------------------------------------------------------ > > This SF.net email is sponsored by: > > SourcForge Community > > SourceForge wants to tell your story. > > http://p.sf.net/sfu/sf-spreadtheword > > -- > > _______________________________________________ > > Dri-devel mailing list > > Dri-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/dri-devel > > > > > ------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel