summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/intel_module.c18
-rw-r--r--src/sna/sna_driver.c17
2 files changed, 16 insertions, 19 deletions
diff --git a/src/intel_module.c b/src/intel_module.c
index d764dbbe..a5d071b1 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -546,6 +546,14 @@ intel_platform_probe(DriverPtr driver,
return FALSE;
scrn = xf86AllocateScreen(driver, 0);
+ if (scrn == NULL)
+ return FALSE;
+
+ xf86DrvMsg(scrn->scrnIndex, X_INFO,
+ "using device path '%s'\n", path ? path : "Default device");
+
+ if (xf86IsEntitySharable(entity_num))
+ xf86SetEntityShared(entity_num);
xf86AddEntityToScreen(scrn, entity_num);
scrn->driverVersion = INTEL_VERSION;
@@ -553,20 +561,16 @@ intel_platform_probe(DriverPtr driver,
scrn->name = INTEL_NAME;
scrn->driverPrivate = (void *)(match_data | 1);
scrn->Probe = NULL;
+
switch (get_accel_method()) {
#if USE_SNA
- case SNA: sna_init_scrn(scrn, entity_num); break;
+ case SNA: return sna_init_scrn(scrn, entity_num);
#endif
-
#if USE_UXA
- case UXA: intel_init_scrn(scrn); break;
+ case UXA: return intel_init_scrn(scrn);
#endif
default: return FALSE;
}
-
- xf86DrvMsg(scrn->scrnIndex, X_INFO,
- "using drv %s\n", path ? path : "Default device");
- return scrn != NULL;
}
#endif
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index f0db471d..a5c106e3 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -226,7 +226,7 @@ struct sna_device {
int fd;
int open_count;
};
-static int sna_device_key;
+static int sna_device_key = -1;
static inline struct sna_device *sna_device(ScrnInfoPtr scrn)
{
@@ -1080,8 +1080,6 @@ static Bool sna_pm_event(SCRN_ARG_TYPE arg, pmEvent event, Bool undo)
Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
{
- EntityInfoPtr entity;
-
#if defined(USE_GIT_DESCRIBE)
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"SNA compiled from %s\n", git_version);
@@ -1105,7 +1103,8 @@ Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
DBG(("%s\n", __FUNCTION__));
DBG(("pixman version: %s\n", pixman_version_string()));
- sna_device_key = xf86AllocateEntityPrivateIndex();
+ if (sna_device_key == -1)
+ sna_device_key = xf86AllocateEntityPrivateIndex();
scrn->PreInit = sna_pre_init;
scrn->ScreenInit = sna_screen_init;
@@ -1119,15 +1118,9 @@ Bool sna_init_scrn(ScrnInfoPtr scrn, int entity_num)
scrn->ModeSet = sna_mode_set;
- entity = xf86GetEntityInfo(entity_num);
- if (!entity)
- return FALSE;
-
xf86SetEntitySharable(entity_num);
- xf86SetEntityInstanceForScreen(scrn,
- entity->index,
- xf86GetNumEntityInstances(entity->index)-1);
- free(entity);
+ xf86SetEntityInstanceForScreen(scrn, entity_num,
+ xf86GetNumEntityInstances(entity_num)-1);
return TRUE;
}