drm_agpsupport.c (183573) | drm_agpsupport.c (183833) |
---|---|
1/*- 2 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation --- 15 unchanged lines hidden (view full) --- 24 * 25 * Author: 26 * Rickard E. (Rik) Faith <faith@valinux.com> 27 * Gareth Hughes <gareth@valinux.com> 28 * 29 */ 30 31#include <sys/cdefs.h> | 1/*- 2 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. 3 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation --- 15 unchanged lines hidden (view full) --- 24 * 25 * Author: 26 * Rickard E. (Rik) Faith <faith@valinux.com> 27 * Gareth Hughes <gareth@valinux.com> 28 * 29 */ 30 31#include <sys/cdefs.h> |
32__FBSDID("$FreeBSD: head/sys/dev/drm/drm_agpsupport.c 183573 2008-10-03 16:59:11Z rnoland $"); | 32__FBSDID("$FreeBSD: head/sys/dev/drm/drm_agpsupport.c 183833 2008-10-13 18:03:27Z rnoland $"); |
33 34/** @file drm_agpsupport.c 35 * Support code for tying the kernel AGP support to DRM drivers and 36 * the DRM's AGP ioctls. 37 */ 38 39#include "dev/drm/drmP.h" 40 --- 166 unchanged lines hidden (view full) --- 207 void *handle; 208 unsigned long pages; 209 u_int32_t type; 210 struct agp_memory_info info; 211 212 if (!dev->agp || !dev->agp->acquired) 213 return EINVAL; 214 | 33 34/** @file drm_agpsupport.c 35 * Support code for tying the kernel AGP support to DRM drivers and 36 * the DRM's AGP ioctls. 37 */ 38 39#include "dev/drm/drmP.h" 40 --- 166 unchanged lines hidden (view full) --- 207 void *handle; 208 unsigned long pages; 209 u_int32_t type; 210 struct agp_memory_info info; 211 212 if (!dev->agp || !dev->agp->acquired) 213 return EINVAL; 214 |
215 entry = malloc(sizeof(*entry), M_DRM, M_NOWAIT | M_ZERO); | 215 entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT | M_ZERO); |
216 if (entry == NULL) 217 return ENOMEM; 218 219 pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; 220 type = (u_int32_t) request->type; 221 222 DRM_UNLOCK(); 223 handle = drm_agp_allocate_memory(pages, type); 224 DRM_LOCK(); 225 if (handle == NULL) { | 216 if (entry == NULL) 217 return ENOMEM; 218 219 pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; 220 type = (u_int32_t) request->type; 221 222 DRM_UNLOCK(); 223 handle = drm_agp_allocate_memory(pages, type); 224 DRM_LOCK(); 225 if (handle == NULL) { |
226 free(entry, M_DRM); | 226 free(entry, DRM_MEM_AGPLISTS); |
227 return ENOMEM; 228 } 229 230 entry->handle = handle; 231 entry->bound = 0; 232 entry->pages = pages; 233 entry->prev = NULL; 234 entry->next = dev->agp->memory; --- 134 unchanged lines hidden (view full) --- 369 entry->next->prev = entry->prev; 370 371 DRM_UNLOCK(); 372 if (entry->bound) 373 drm_agp_unbind_memory(entry->handle); 374 drm_agp_free_memory(entry->handle); 375 DRM_LOCK(); 376 | 227 return ENOMEM; 228 } 229 230 entry->handle = handle; 231 entry->bound = 0; 232 entry->pages = pages; 233 entry->prev = NULL; 234 entry->next = dev->agp->memory; --- 134 unchanged lines hidden (view full) --- 369 entry->next->prev = entry->prev; 370 371 DRM_UNLOCK(); 372 if (entry->bound) 373 drm_agp_unbind_memory(entry->handle); 374 drm_agp_free_memory(entry->handle); 375 DRM_LOCK(); 376 |
377 free(entry, M_DRM); | 377 free(entry, DRM_MEM_AGPLISTS); |
378 379 return 0; 380 381} 382 383int drm_agp_free_ioctl(struct drm_device *dev, void *data, 384 struct drm_file *file_priv) 385{ --- 17 unchanged lines hidden (view full) --- 403 404 agpdev = DRM_AGP_FIND_DEVICE(); 405 if (!agpdev) 406 agp_available = 0; 407 408 DRM_DEBUG("agp_available = %d\n", agp_available); 409 410 if (agp_available) { | 378 379 return 0; 380 381} 382 383int drm_agp_free_ioctl(struct drm_device *dev, void *data, 384 struct drm_file *file_priv) 385{ --- 17 unchanged lines hidden (view full) --- 403 404 agpdev = DRM_AGP_FIND_DEVICE(); 405 if (!agpdev) 406 agp_available = 0; 407 408 DRM_DEBUG("agp_available = %d\n", agp_available); 409 410 if (agp_available) { |
411 head = malloc(sizeof(*head), M_DRM, M_NOWAIT | M_ZERO); | 411 head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, 412 M_NOWAIT | M_ZERO); |
412 if (head == NULL) 413 return NULL; 414 head->agpdev = agpdev; 415 agp_get_info(agpdev, &head->info); 416 head->base = head->info.ai_aperture_base; 417 head->memory = NULL; 418 DRM_INFO("AGP at 0x%08lx %dMB\n", 419 (long)head->info.ai_aperture_base, --- 49 unchanged lines hidden --- | 413 if (head == NULL) 414 return NULL; 415 head->agpdev = agpdev; 416 agp_get_info(agpdev, &head->info); 417 head->base = head->info.ai_aperture_base; 418 head->memory = NULL; 419 DRM_INFO("AGP at 0x%08lx %dMB\n", 420 (long)head->info.ai_aperture_base, --- 49 unchanged lines hidden --- |