intel: Handle fallback probing without match_data
One extreme fallback path through the xf86PlatformProbe results in a call without any match data. As we have a device by this point, we can simply do a reverse match. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
6c157a925f
commit
a47f8683fe
|
|
@ -64,6 +64,31 @@ struct intel_device {
|
|||
|
||||
static int intel_device_key = -1;
|
||||
|
||||
static int __intel_get_device_id(int fd)
|
||||
{
|
||||
struct drm_i915_getparam gp;
|
||||
int devid;
|
||||
|
||||
gp.param = I915_PARAM_CHIPSET_ID;
|
||||
gp.value = &devid;
|
||||
|
||||
if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)))
|
||||
return 0;
|
||||
|
||||
return devid;
|
||||
}
|
||||
|
||||
int intel_entity_get_devid(int index)
|
||||
{
|
||||
struct intel_device *dev;
|
||||
|
||||
dev = xf86GetEntityPrivate(index, intel_device_key)->ptr;
|
||||
if (dev == NULL)
|
||||
return 0;
|
||||
|
||||
return __intel_get_device_id(dev->fd);
|
||||
}
|
||||
|
||||
static inline struct intel_device *intel_device(ScrnInfoPtr scrn)
|
||||
{
|
||||
if (scrn->entityList == NULL)
|
||||
|
|
@ -376,18 +401,8 @@ const char *intel_get_client_name(ScrnInfoPtr scrn)
|
|||
int intel_get_device_id(ScrnInfoPtr scrn)
|
||||
{
|
||||
struct intel_device *dev = intel_device(scrn);
|
||||
struct drm_i915_getparam gp;
|
||||
int devid;
|
||||
|
||||
assert(dev && dev->fd != -1);
|
||||
|
||||
gp.param = I915_PARAM_CHIPSET_ID;
|
||||
gp.value = &devid;
|
||||
|
||||
if (ioctl(dev->fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)))
|
||||
return 0;
|
||||
|
||||
return devid;
|
||||
return __intel_get_device_id(dev->fd);
|
||||
}
|
||||
|
||||
int intel_get_master(ScrnInfoPtr scrn)
|
||||
|
|
|
|||
|
|
@ -118,6 +118,8 @@ struct intel_device_info {
|
|||
int gen;
|
||||
};
|
||||
|
||||
int intel_entity_get_devid(int index);
|
||||
|
||||
void intel_detect_chipset(ScrnInfoPtr scrn, EntityInfoPtr ent);
|
||||
|
||||
int intel_open_device(int entity_num,
|
||||
|
|
|
|||
|
|
@ -454,6 +454,22 @@ intel_scrn_create(DriverPtr driver,
|
|||
{
|
||||
ScrnInfoPtr scrn;
|
||||
|
||||
if (match_data == 0) {
|
||||
int devid = intel_entity_get_devid(entity_num), i;
|
||||
if (devid == 0)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; intel_device_match[i].device_id != 0; i++) {
|
||||
if (devid == intel_device_match[i].device_id) {
|
||||
match_data = (intptr_t)&intel_device_match[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (match_data == 0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
scrn = xf86AllocateScreen(driver, flags);
|
||||
if (scrn == NULL)
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue