aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 1a60626f680..f112c769d53 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -643,9 +643,9 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
643 return -EINVAL; 643 return -EINVAL;
644 644
645 if (batch->num_cliprects) { 645 if (batch->num_cliprects) {
646 cliprects = drm_calloc(batch->num_cliprects, 646 cliprects = kcalloc(batch->num_cliprects,
647 sizeof(struct drm_clip_rect), 647 sizeof(struct drm_clip_rect),
648 DRM_MEM_DRIVER); 648 GFP_KERNEL);
649 if (cliprects == NULL) 649 if (cliprects == NULL)
650 return -ENOMEM; 650 return -ENOMEM;
651 651
@@ -664,9 +664,7 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
664 sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 664 sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
665 665
666fail_free: 666fail_free:
667 drm_free(cliprects, 667 kfree(cliprects);
668 batch->num_cliprects * sizeof(struct drm_clip_rect),
669 DRM_MEM_DRIVER);
670 668
671 return ret; 669 return ret;
672} 670}
@@ -692,7 +690,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
692 if (cmdbuf->num_cliprects < 0) 690 if (cmdbuf->num_cliprects < 0)
693 return -EINVAL; 691 return -EINVAL;
694 692
695 batch_data = drm_alloc(cmdbuf->sz, DRM_MEM_DRIVER); 693 batch_data = kmalloc(cmdbuf->sz, GFP_KERNEL);
696 if (batch_data == NULL) 694 if (batch_data == NULL)
697 return -ENOMEM; 695 return -ENOMEM;
698 696
@@ -701,9 +699,8 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
701 goto fail_batch_free; 699 goto fail_batch_free;
702 700
703 if (cmdbuf->num_cliprects) { 701 if (cmdbuf->num_cliprects) {
704 cliprects = drm_calloc(cmdbuf->num_cliprects, 702 cliprects = kcalloc(cmdbuf->num_cliprects,
705 sizeof(struct drm_clip_rect), 703 sizeof(struct drm_clip_rect), GFP_KERNEL);
706 DRM_MEM_DRIVER);
707 if (cliprects == NULL) 704 if (cliprects == NULL)
708 goto fail_batch_free; 705 goto fail_batch_free;
709 706
@@ -726,11 +723,9 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
726 sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); 723 sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv);
727 724
728fail_clip_free: 725fail_clip_free:
729 drm_free(cliprects, 726 kfree(cliprects);
730 cmdbuf->num_cliprects * sizeof(struct drm_clip_rect),
731 DRM_MEM_DRIVER);
732fail_batch_free: 727fail_batch_free:
733 drm_free(batch_data, cmdbuf->sz, DRM_MEM_DRIVER); 728 kfree(batch_data);
734 729
735 return ret; 730 return ret;
736} 731}
@@ -1067,7 +1062,7 @@ int i915_master_create(struct drm_device *dev, struct drm_master *master)
1067{ 1062{
1068 struct drm_i915_master_private *master_priv; 1063 struct drm_i915_master_private *master_priv;
1069 1064
1070 master_priv = drm_calloc(1, sizeof(*master_priv), DRM_MEM_DRIVER); 1065 master_priv = kzalloc(sizeof(*master_priv), GFP_KERNEL);
1071 if (!master_priv) 1066 if (!master_priv)
1072 return -ENOMEM; 1067 return -ENOMEM;
1073 1068
@@ -1082,7 +1077,7 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master)
1082 if (!master_priv) 1077 if (!master_priv)
1083 return; 1078 return;
1084 1079
1085 drm_free(master_priv, sizeof(*master_priv), DRM_MEM_DRIVER); 1080 kfree(master_priv);
1086 1081
1087 master->driver_priv = NULL; 1082 master->driver_priv = NULL;
1088} 1083}
@@ -1111,12 +1106,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1111 dev->types[8] = _DRM_STAT_SECONDARY; 1106 dev->types[8] = _DRM_STAT_SECONDARY;
1112 dev->types[9] = _DRM_STAT_DMA; 1107 dev->types[9] = _DRM_STAT_DMA;
1113 1108
1114 dev_priv = drm_alloc(sizeof(drm_i915_private_t), DRM_MEM_DRIVER); 1109 dev_priv = kzalloc(sizeof(drm_i915_private_t), GFP_KERNEL);
1115 if (dev_priv == NULL) 1110 if (dev_priv == NULL)
1116 return -ENOMEM; 1111 return -ENOMEM;
1117 1112
1118 memset(dev_priv, 0, sizeof(drm_i915_private_t));
1119
1120 dev->dev_private = (void *)dev_priv; 1113 dev->dev_private = (void *)dev_priv;
1121 dev_priv->dev = dev; 1114 dev_priv->dev = dev;
1122 1115
@@ -1153,13 +1146,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
1153 "performance may suffer.\n"); 1146 "performance may suffer.\n");
1154 } 1147 }
1155 1148
1156#ifdef CONFIG_HIGHMEM64G
1157 /* don't enable GEM on PAE - needs agp + set_memory_* interface fixes */
1158 dev_priv->has_gem = 0;
1159#else
1160 /* enable GEM by default */ 1149 /* enable GEM by default */
1161 dev_priv->has_gem = 1; 1150 dev_priv->has_gem = 1;
1162#endif
1163 1151
1164 dev->driver->get_vblank_counter = i915_get_vblank_counter; 1152 dev->driver->get_vblank_counter = i915_get_vblank_counter;
1165 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ 1153 dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
@@ -1221,7 +1209,7 @@ out_iomapfree:
1221out_rmmap: 1209out_rmmap:
1222 iounmap(dev_priv->regs); 1210 iounmap(dev_priv->regs);
1223free_priv: 1211free_priv:
1224 drm_free(dev_priv, sizeof(struct drm_i915_private), DRM_MEM_DRIVER); 1212 kfree(dev_priv);
1225 return ret; 1213 return ret;
1226} 1214}
1227 1215
@@ -1261,8 +1249,7 @@ int i915_driver_unload(struct drm_device *dev)
1261 i915_gem_lastclose(dev); 1249 i915_gem_lastclose(dev);
1262 } 1250 }
1263 1251
1264 drm_free(dev->dev_private, sizeof(drm_i915_private_t), 1252 kfree(dev->dev_private);
1265 DRM_MEM_DRIVER);
1266 1253
1267 return 0; 1254 return 0;
1268} 1255}
@@ -1273,7 +1260,7 @@ int i915_driver_open(struct drm_device *dev, struct drm_file *file_priv)
1273 1260
1274 DRM_DEBUG_DRIVER(I915_DRV, "\n"); 1261 DRM_DEBUG_DRIVER(I915_DRV, "\n");
1275 i915_file_priv = (struct drm_i915_file_private *) 1262 i915_file_priv = (struct drm_i915_file_private *)
1276 drm_alloc(sizeof(*i915_file_priv), DRM_MEM_FILES); 1263 kmalloc(sizeof(*i915_file_priv), GFP_KERNEL);
1277 1264
1278 if (!i915_file_priv) 1265 if (!i915_file_priv)
1279 return -ENOMEM; 1266 return -ENOMEM;
@@ -1326,7 +1313,7 @@ void i915_driver_postclose(struct drm_device *dev, struct drm_file *file_priv)
1326{ 1313{
1327 struct drm_i915_file_private *i915_file_priv = file_priv->driver_priv; 1314 struct drm_i915_file_private *i915_file_priv = file_priv->driver_priv;
1328 1315
1329 drm_free(i915_file_priv, sizeof(*i915_file_priv), DRM_MEM_FILES); 1316 kfree(i915_file_priv);
1330} 1317}
1331 1318
1332struct drm_ioctl_desc i915_ioctls[] = { 1319struct drm_ioctl_desc i915_ioctls[] = {