summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2006-09-28 15:56:00 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2006-09-28 15:56:00 +0000
commitd431dd49cb255c119d2234a22431a5308d083407 (patch)
treeb9c27b7e0b9fe25bc282abc02670f24fa0ea139c
parentb25c826e596509f17491670c6f5d83547b120bc0 (diff)
Do some extra checking to avoid segfaults when incorrect AGP is in use.
-rw-r--r--src/mesa/drivers/dri/i915/intel_batchpool.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_batchpool.c b/src/mesa/drivers/dri/i915/intel_batchpool.c
index fb5b236a09..ebe7a35828 100644
--- a/src/mesa/drivers/dri/i915/intel_batchpool.c
+++ b/src/mesa/drivers/dri/i915/intel_batchpool.c
@@ -397,6 +397,8 @@ driBatchPoolInit(int fd, unsigned flags,
return NULL;
pool->data = createBPool(fd, bufSize, numBufs, flags, checkDelayed);
+ if (!pool->data)
+ return NULL;
pool->fd = fd;
pool->map = &pool_map;
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index 8a4875538b..288fa23728 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -470,19 +470,28 @@ intelInitDriver(__DRIscreenPrivate * sPriv)
}
intelScreen->regionPool = driDRMPoolInit(sPriv->fd);
+
if (!intelScreen->regionPool)
return GL_FALSE;
+
intelScreen->staticPool = driDRMStaticPoolInit(sPriv->fd);
+
if (!intelScreen->staticPool)
return GL_FALSE;
+
intelScreen->texPool = intelScreen->regionPool;
+
intelScreen->batchPool = driBatchPoolInit(sPriv->fd,
DRM_BO_FLAG_EXE |
DRM_BO_FLAG_MEM_TT |
DRM_BO_FLAG_MEM_LOCAL,
4096, 100, 5);
- intel_recreate_static_regions(intelScreen);
+ if (!intelScreen->batchPool) {
+ fprintf(stderr, "Failed to initialize batch pool - possible incorrect agpgart installed\n");
+ return GL_FALSE;
+ }
+ intel_recreate_static_regions(intelScreen);
return GL_TRUE;
}