summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-12-21 12:05:49 +0100
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-12-21 12:05:49 +0100
commit72cb361c5cbf4f0aeae25312369087b8a234bc5a (patch)
tree995aa95cefab578add1c590bf2a0a5cce1f91892 /linux-core
parentae5822561370b34808603820a063fc6e8b17dbe2 (diff)
Bug #9120.
Require at least agpgart version 0.102 for the AGP TTM backend. This should hopefully avoid crashes when the wrong agpgart driver is installed.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_agpsupport.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index 79d9a835..9cdbdaf0 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -559,6 +559,8 @@ int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
#define AGP_USER_MEMORY (AGP_USER_TYPES)
#define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
#endif
+#define AGP_REQUIRED_MAJOR 0
+#define AGP_REQUIRED_MINOR 102
static int drm_agp_needs_unbind_cache_adjust(drm_ttm_backend_t *backend) {
return ((backend->flags & DRM_BE_FLAG_BOUND_CACHED) ? 0 : 1);
@@ -669,6 +671,24 @@ drm_ttm_backend_t *drm_agp_init_ttm(struct drm_device *dev,
drm_ttm_backend_t *agp_be;
drm_agp_ttm_priv *agp_priv;
+ struct agp_kern_info *info;
+
+ if (!dev->agp) {
+ DRM_ERROR("AGP is not initialized.\n");
+ return NULL;
+ }
+ info = &dev->agp->agp_info;
+
+ if (info->version.major != AGP_REQUIRED_MAJOR ||
+ info->version.minor < AGP_REQUIRED_MINOR) {
+ DRM_ERROR("Wrong agpgart version %d.%d\n"
+ "\tYou need at least version %d.%d.\n",
+ info->version.major,
+ info->version.minor,
+ AGP_REQUIRED_MAJOR,
+ AGP_REQUIRED_MINOR);
+ return NULL;
+ }
agp_be = (backend != NULL) ? backend:
drm_ctl_calloc(1, sizeof(*agp_be), DRM_MEM_MAPPINGS);
@@ -683,6 +703,7 @@ drm_ttm_backend_t *drm_agp_init_ttm(struct drm_device *dev,
return NULL;
}
+
agp_priv->mem = NULL;
agp_priv->alloc_type = AGP_USER_MEMORY;
agp_priv->cached_type = AGP_USER_CACHED_MEMORY;