drm: Fix support for PCI domains

(For some reason I thought that went in ages ago ...)

This fixes support for PCI domains in what should hopefully be a backward
compatible way along with a change to libdrm.

When the interface version is set to 1.4, we assume userspace understands
domains and the world is at peace. We thus pass proper domain numbers
instead of 0 to userspace.

The newer libdrm will then try 1.4 first, and fallback to 1.1, along with
ignoring domains in the later case (well, except on alpha of course)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Benjamin Herrenschmidt 2010-08-06 13:55:10 +10:00 committed by Dave Airlie
parent c3b6ef8633
commit c17c2f892e
3 changed files with 18 additions and 7 deletions

View file

@ -392,6 +392,7 @@ int drm_setversion(struct drm_device *dev, void *data, struct drm_file *file_pri
if (sv->drm_di_minor >= 1) { if (sv->drm_di_minor >= 1) {
/* /*
* Version 1.1 includes tying of DRM to specific device * Version 1.1 includes tying of DRM to specific device
* Version 1.4 has proper PCI domain support
*/ */
retcode = drm_set_busid(dev, file_priv); retcode = drm_set_busid(dev, file_priv);
if (retcode) if (retcode)

View file

@ -1075,7 +1075,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
return ((dev->driver->driver_features & feature) ? 1 : 0); return ((dev->driver->driver_features & feature) ? 1 : 0);
} }
static inline int drm_dev_to_irq(struct drm_device *dev) static inline int drm_dev_to_irq(struct drm_device *dev)
{ {
if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE)) if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
@ -1084,11 +1083,22 @@ static inline int drm_dev_to_irq(struct drm_device *dev)
return dev->pdev->irq; return dev->pdev->irq;
} }
#ifdef __alpha__ static inline int drm_get_pci_domain(struct drm_device *dev)
#define drm_get_pci_domain(dev) dev->hose->index {
#else if (drm_core_check_feature(dev, DRIVER_USE_PLATFORM_DEVICE))
#define drm_get_pci_domain(dev) 0 return 0;
#endif
#ifndef __alpha__
/* For historical reasons, drm_get_pci_domain() is busticated
* on most archs and has to remain so for userspace interface
* < 1.4, except on alpha which was right from the beginning
*/
if (dev->if_version < 0x10004)
return 0;
#endif /* __alpha__ */
return pci_domain_nr(dev->pdev->bus);
}
#if __OS_HAS_AGP #if __OS_HAS_AGP
static inline int drm_core_has_AGP(struct drm_device *dev) static inline int drm_core_has_AGP(struct drm_device *dev)

View file

@ -27,7 +27,7 @@
#define CORE_DATE "20060810" #define CORE_DATE "20060810"
#define DRM_IF_MAJOR 1 #define DRM_IF_MAJOR 1
#define DRM_IF_MINOR 3 #define DRM_IF_MINOR 4
#define CORE_MAJOR 1 #define CORE_MAJOR 1
#define CORE_MINOR 1 #define CORE_MINOR 1