diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index ee64b7301f67..81f1cff56fd5 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -731,8 +731,11 @@ static int i915_getparam(struct drm_device *dev, void *data, | |||
731 | case I915_PARAM_HAS_GEM: | 731 | case I915_PARAM_HAS_GEM: |
732 | value = dev_priv->has_gem; | 732 | value = dev_priv->has_gem; |
733 | break; | 733 | break; |
734 | case I915_PARAM_NUM_FENCES_AVAIL: | ||
735 | value = dev_priv->num_fence_regs - dev_priv->fence_reg_start; | ||
736 | break; | ||
734 | default: | 737 | default: |
735 | DRM_ERROR("Unknown parameter %d\n", param->param); | 738 | DRM_DEBUG("Unknown parameter %d\n", param->param); |
736 | return -EINVAL; | 739 | return -EINVAL; |
737 | } | 740 | } |
738 | 741 | ||
@@ -764,8 +767,15 @@ static int i915_setparam(struct drm_device *dev, void *data, | |||
764 | case I915_SETPARAM_ALLOW_BATCHBUFFER: | 767 | case I915_SETPARAM_ALLOW_BATCHBUFFER: |
765 | dev_priv->allow_batchbuffer = param->value; | 768 | dev_priv->allow_batchbuffer = param->value; |
766 | break; | 769 | break; |
770 | case I915_SETPARAM_NUM_USED_FENCES: | ||
771 | if (param->value > dev_priv->num_fence_regs || | ||
772 | param->value < 0) | ||
773 | return -EINVAL; | ||
774 | /* Userspace can use first N regs */ | ||
775 | dev_priv->fence_reg_start = param->value; | ||
776 | break; | ||
767 | default: | 777 | default: |
768 | DRM_ERROR("unknown parameter %d\n", param->param); | 778 | DRM_DEBUG("unknown parameter %d\n", param->param); |
769 | return -EINVAL; | 779 | return -EINVAL; |
770 | } | 780 | } |
771 | 781 | ||
@@ -966,10 +976,6 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
966 | if (ret) | 976 | if (ret) |
967 | goto kfree_devname; | 977 | goto kfree_devname; |
968 | 978 | ||
969 | dev_priv->mm.gtt_mapping = | ||
970 | io_mapping_create_wc(dev->agp->base, | ||
971 | dev->agp->agp_info.aper_size * 1024*1024); | ||
972 | |||
973 | /* Allow hardware batchbuffers unless told otherwise. | 979 | /* Allow hardware batchbuffers unless told otherwise. |
974 | */ | 980 | */ |
975 | dev_priv->allow_batchbuffer = 1; | 981 | dev_priv->allow_batchbuffer = 1; |
@@ -1081,6 +1087,23 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1081 | goto free_priv; | 1087 | goto free_priv; |
1082 | } | 1088 | } |
1083 | 1089 | ||
1090 | dev_priv->mm.gtt_mapping = | ||
1091 | io_mapping_create_wc(dev->agp->base, | ||
1092 | dev->agp->agp_info.aper_size * 1024*1024); | ||
1093 | /* Set up a WC MTRR for non-PAT systems. This is more common than | ||
1094 | * one would think, because the kernel disables PAT on first | ||
1095 | * generation Core chips because WC PAT gets overridden by a UC | ||
1096 | * MTRR if present. Even if a UC MTRR isn't present. | ||
1097 | */ | ||
1098 | dev_priv->mm.gtt_mtrr = mtrr_add(dev->agp->base, | ||
1099 | dev->agp->agp_info.aper_size * | ||
1100 | 1024 * 1024, | ||
1101 | MTRR_TYPE_WRCOMB, 1); | ||
1102 | if (dev_priv->mm.gtt_mtrr < 0) { | ||
1103 | DRM_INFO("MTRR allocation failed\n. Graphics " | ||
1104 | "performance may suffer.\n"); | ||
1105 | } | ||
1106 | |||
1084 | #ifdef CONFIG_HIGHMEM64G | 1107 | #ifdef CONFIG_HIGHMEM64G |
1085 | /* don't enable GEM on PAE - needs agp + set_memory_* interface fixes */ | 1108 | /* don't enable GEM on PAE - needs agp + set_memory_* interface fixes */ |
1086 | dev_priv->has_gem = 0; | 1109 | dev_priv->has_gem = 0; |
@@ -1089,6 +1112,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1089 | dev_priv->has_gem = 1; | 1112 | dev_priv->has_gem = 1; |
1090 | #endif | 1113 | #endif |
1091 | 1114 | ||
1115 | dev->driver->get_vblank_counter = i915_get_vblank_counter; | ||
1116 | if (IS_GM45(dev)) | ||
1117 | dev->driver->get_vblank_counter = gm45_get_vblank_counter; | ||
1118 | |||
1092 | i915_gem_load(dev); | 1119 | i915_gem_load(dev); |
1093 | 1120 | ||
1094 | /* Init HWS */ | 1121 | /* Init HWS */ |
@@ -1145,8 +1172,14 @@ int i915_driver_unload(struct drm_device *dev) | |||
1145 | { | 1172 | { |
1146 | struct drm_i915_private *dev_priv = dev->dev_private; | 1173 | struct drm_i915_private *dev_priv = dev->dev_private; |
1147 | 1174 | ||
1175 | io_mapping_free(dev_priv->mm.gtt_mapping); | ||
1176 | if (dev_priv->mm.gtt_mtrr >= 0) { | ||
1177 | mtrr_del(dev_priv->mm.gtt_mtrr, dev->agp->base, | ||
1178 | dev->agp->agp_info.aper_size * 1024 * 1024); | ||
1179 | dev_priv->mm.gtt_mtrr = -1; | ||
1180 | } | ||
1181 | |||
1148 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1182 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1149 | io_mapping_free(dev_priv->mm.gtt_mapping); | ||
1150 | drm_irq_uninstall(dev); | 1183 | drm_irq_uninstall(dev); |
1151 | } | 1184 | } |
1152 | 1185 | ||