Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
drm/i915: Fix cursor physical address choice to match the 2D driver.
drm: stash AGP include under the do-we-have-AGP ifdef
drm: don't whine about not reading EDID data
drm/i915: hook up LVDS DPMS property
drm/i915: remove unnecessary debug output in KMS init
i915: fix freeing path for gem phys objects.
drm: create mode_config idr lock
drm: fix leak of device mappings since multi-master changes.

+44 -12
+2 -1
drivers/gpu/drm/drm_agpsupport.c
··· 33 34 #include "drmP.h" 35 #include <linux/module.h> 36 - #include <asm/agp.h> 37 38 #if __OS_HAS_AGP 39 40 /** 41 * Get AGP information.
··· 33 34 #include "drmP.h" 35 #include <linux/module.h> 36 37 #if __OS_HAS_AGP 38 + 39 + #include <asm/agp.h> 40 41 /** 42 * Get AGP information.
+9 -5
drivers/gpu/drm/drm_crtc.c
··· 194 * @type: object type 195 * 196 * LOCKING: 197 - * Caller must hold DRM mode_config lock. 198 * 199 * Create a unique identifier based on @ptr in @dev's identifier space. Used 200 * for tracking modes, CRTCs and connectors. ··· 208 int new_id = 0; 209 int ret; 210 211 - WARN(!mutex_is_locked(&dev->mode_config.mutex), 212 - "%s called w/o mode_config lock\n", __func__); 213 again: 214 if (idr_pre_get(&dev->mode_config.crtc_idr, GFP_KERNEL) == 0) { 215 DRM_ERROR("Ran out memory getting a mode number\n"); 216 return -EINVAL; 217 } 218 219 ret = idr_get_new_above(&dev->mode_config.crtc_idr, obj, 1, &new_id); 220 if (ret == -EAGAIN) 221 goto again; 222 ··· 238 static void drm_mode_object_put(struct drm_device *dev, 239 struct drm_mode_object *object) 240 { 241 idr_remove(&dev->mode_config.crtc_idr, object->id); 242 } 243 244 void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type) 245 { 246 - struct drm_mode_object *obj; 247 248 obj = idr_find(&dev->mode_config.crtc_idr, id); 249 if (!obj || (obj->type != type) || (obj->id != id)) 250 - return NULL; 251 252 return obj; 253 } ··· 789 void drm_mode_config_init(struct drm_device *dev) 790 { 791 mutex_init(&dev->mode_config.mutex); 792 INIT_LIST_HEAD(&dev->mode_config.fb_list); 793 INIT_LIST_HEAD(&dev->mode_config.fb_kernel_list); 794 INIT_LIST_HEAD(&dev->mode_config.crtc_list);
··· 194 * @type: object type 195 * 196 * LOCKING: 197 * 198 * Create a unique identifier based on @ptr in @dev's identifier space. Used 199 * for tracking modes, CRTCs and connectors. ··· 209 int new_id = 0; 210 int ret; 211 212 again: 213 if (idr_pre_get(&dev->mode_config.crtc_idr, GFP_KERNEL) == 0) { 214 DRM_ERROR("Ran out memory getting a mode number\n"); 215 return -EINVAL; 216 } 217 218 + mutex_lock(&dev->mode_config.idr_mutex); 219 ret = idr_get_new_above(&dev->mode_config.crtc_idr, obj, 1, &new_id); 220 + mutex_unlock(&dev->mode_config.idr_mutex); 221 if (ret == -EAGAIN) 222 goto again; 223 ··· 239 static void drm_mode_object_put(struct drm_device *dev, 240 struct drm_mode_object *object) 241 { 242 + mutex_lock(&dev->mode_config.idr_mutex); 243 idr_remove(&dev->mode_config.crtc_idr, object->id); 244 + mutex_unlock(&dev->mode_config.idr_mutex); 245 } 246 247 void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type) 248 { 249 + struct drm_mode_object *obj = NULL; 250 251 + mutex_lock(&dev->mode_config.idr_mutex); 252 obj = idr_find(&dev->mode_config.crtc_idr, id); 253 if (!obj || (obj->type != type) || (obj->id != id)) 254 + obj = NULL; 255 + mutex_unlock(&dev->mode_config.idr_mutex); 256 257 return obj; 258 } ··· 786 void drm_mode_config_init(struct drm_device *dev) 787 { 788 mutex_init(&dev->mode_config.mutex); 789 + mutex_init(&dev->mode_config.idr_mutex); 790 INIT_LIST_HEAD(&dev->mode_config.fb_list); 791 INIT_LIST_HEAD(&dev->mode_config.fb_kernel_list); 792 INIT_LIST_HEAD(&dev->mode_config.crtc_list);
+4
drivers/gpu/drm/drm_drv.c
··· 294 */ 295 static void drm_cleanup(struct drm_device * dev) 296 { 297 DRM_DEBUG("\n"); 298 299 if (!dev) { ··· 325 326 drm_ht_remove(&dev->map_hash); 327 drm_ctxbitmap_cleanup(dev); 328 329 if (drm_core_check_feature(dev, DRIVER_MODESET)) 330 drm_put_minor(&dev->control);
··· 294 */ 295 static void drm_cleanup(struct drm_device * dev) 296 { 297 + struct drm_map_list *r_list, *list_temp; 298 DRM_DEBUG("\n"); 299 300 if (!dev) { ··· 324 325 drm_ht_remove(&dev->map_hash); 326 drm_ctxbitmap_cleanup(dev); 327 + 328 + list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) 329 + drm_rmmap(dev, r_list->map); 330 331 if (drm_core_check_feature(dev, DRIVER_MODESET)) 332 drm_put_minor(&dev->control);
+1 -1
drivers/gpu/drm/drm_edid.c
··· 660 661 edid = (struct edid *)drm_ddc_read(adapter); 662 if (!edid) { 663 - dev_warn(&connector->dev->pdev->dev, "%s: no EDID data\n", 664 drm_get_connector_name(connector)); 665 return NULL; 666 }
··· 660 661 edid = (struct edid *)drm_ddc_read(adapter); 662 if (!edid) { 663 + dev_info(&connector->dev->pdev->dev, "%s: no EDID data\n", 664 drm_get_connector_name(connector)); 665 return NULL; 666 }
+8
drivers/gpu/drm/drm_stub.c
··· 118 struct drm_master *master = container_of(kref, struct drm_master, refcount); 119 struct drm_magic_entry *pt, *next; 120 struct drm_device *dev = master->minor->dev; 121 122 list_del(&master->head); 123 124 if (dev->driver->master_destroy) 125 dev->driver->master_destroy(dev, master); 126 127 if (master->unique) { 128 drm_free(master->unique, master->unique_size, DRM_MEM_DRIVER);
··· 118 struct drm_master *master = container_of(kref, struct drm_master, refcount); 119 struct drm_magic_entry *pt, *next; 120 struct drm_device *dev = master->minor->dev; 121 + struct drm_map_list *r_list, *list_temp; 122 123 list_del(&master->head); 124 125 if (dev->driver->master_destroy) 126 dev->driver->master_destroy(dev, master); 127 + 128 + list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head) { 129 + if (r_list->master == master) { 130 + drm_rmmap_locked(dev, r_list->map); 131 + r_list = NULL; 132 + } 133 + } 134 135 if (master->unique) { 136 drm_free(master->unique, master->unique_size, DRM_MEM_DRIVER);
+4 -3
drivers/gpu/drm/i915/i915_dma.c
··· 944 dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & 945 0xff000000; 946 947 - DRM_DEBUG("*** fb base 0x%08lx\n", dev->mode_config.fb_base); 948 - 949 - if (IS_MOBILE(dev) || (IS_I9XX(dev) && !IS_I965G(dev) && !IS_G33(dev))) 950 dev_priv->cursor_needs_physical = true; 951 else 952 dev_priv->cursor_needs_physical = false; 953 954 ret = i915_probe_agp(dev, &agp_size, &prealloc_size);
··· 944 dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & 945 0xff000000; 946 947 + if (IS_MOBILE(dev) || IS_I9XX(dev)) 948 dev_priv->cursor_needs_physical = true; 949 else 950 + dev_priv->cursor_needs_physical = false; 951 + 952 + if (IS_I965G(dev) || IS_G33(dev)) 953 dev_priv->cursor_needs_physical = false; 954 955 ret = i915_probe_agp(dev, &agp_size, &prealloc_size);
+1 -1
drivers/gpu/drm/i915/i915_gem.c
··· 3364 { 3365 int i; 3366 3367 - for (i = 0; i < I915_MAX_PHYS_OBJECT; i++) 3368 i915_gem_free_phys_object(dev, i); 3369 } 3370
··· 3364 { 3365 int i; 3366 3367 + for (i = I915_GEM_PHYS_CURSOR_0; i <= I915_MAX_PHYS_OBJECT; i++) 3368 i915_gem_free_phys_object(dev, i); 3369 } 3370
+13
drivers/gpu/drm/i915/intel_lvds.c
··· 340 kfree(connector); 341 } 342 343 static const struct drm_encoder_helper_funcs intel_lvds_helper_funcs = { 344 .dpms = intel_lvds_dpms, 345 .mode_fixup = intel_lvds_mode_fixup, ··· 371 .restore = intel_lvds_restore, 372 .detect = intel_lvds_detect, 373 .fill_modes = drm_helper_probe_single_connector_modes, 374 .destroy = intel_lvds_destroy, 375 }; 376
··· 340 kfree(connector); 341 } 342 343 + static int intel_lvds_set_property(struct drm_connector *connector, 344 + struct drm_property *property, 345 + uint64_t value) 346 + { 347 + struct drm_device *dev = connector->dev; 348 + 349 + if (property == dev->mode_config.dpms_property && connector->encoder) 350 + intel_lvds_dpms(connector->encoder, (uint32_t)(value & 0xf)); 351 + 352 + return 0; 353 + } 354 + 355 static const struct drm_encoder_helper_funcs intel_lvds_helper_funcs = { 356 .dpms = intel_lvds_dpms, 357 .mode_fixup = intel_lvds_mode_fixup, ··· 359 .restore = intel_lvds_restore, 360 .detect = intel_lvds_detect, 361 .fill_modes = drm_helper_probe_single_connector_modes, 362 + .set_property = intel_lvds_set_property, 363 .destroy = intel_lvds_destroy, 364 }; 365
+2 -1
include/drm/drm_crtc.h
··· 528 * 529 */ 530 struct drm_mode_config { 531 - struct mutex mutex; /* protects configuration and IDR */ 532 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 533 /* this is limited to one for now */ 534 int num_fb;
··· 528 * 529 */ 530 struct drm_mode_config { 531 + struct mutex mutex; /* protects configuration (mode lists etc.) */ 532 + struct mutex idr_mutex; /* for IDR management */ 533 struct idr crtc_idr; /* use this idr for all IDs, fb, crtc, connector, modes - just makes life easier */ 534 /* this is limited to one for now */ 535 int num_fb;