Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18ffe4b1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  vmwgfx: Fix fb VRAM pinning failure due to fragmentation
  vmwgfx: Remove initialisation of dev::devname
  vmwgfx: Enable use of the vblank system
  vmwgfx: vt-switch (master drop) fixes
  drm/vmwgfx: Fix breakage introduced by commit "drm: block userspace under allocating buffer and having drivers overwrite it (v2)"
  drm: Hold the mutex when dropping the last GEM reference (v2)
  drm/gem: handlecount isn't really a kref so don't make it one.
  drm: i810/i830: fix locked ioctl variant
  drm/radeon/kms: add quirk for MSI K9A2GM motherboard
  drm/radeon/kms: fix potential segfault in r600_ioctl_wait_idle
  drm: Prune GEM vma entries
  drm/radeon/kms: fix up encoder info messages for DFP6
  drm/radeon: fix PCI ID 5657 to be an RV410
parents b10c4d40 abb295f3
Loading
Loading
Loading
Loading
+10 −29
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ int drm_gem_object_init(struct drm_device *dev,
		return -ENOMEM;

	kref_init(&obj->refcount);
	kref_init(&obj->handlecount);
	atomic_set(&obj->handle_count, 0);
	obj->size = size;

	atomic_inc(&dev->object_count);
@@ -462,28 +462,6 @@ drm_gem_object_free(struct kref *kref)
}
EXPORT_SYMBOL(drm_gem_object_free);

/**
 * Called after the last reference to the object has been lost.
 * Must be called without holding struct_mutex
 *
 * Frees the object
 */
void
drm_gem_object_free_unlocked(struct kref *kref)
{
	struct drm_gem_object *obj = (struct drm_gem_object *) kref;
	struct drm_device *dev = obj->dev;

	if (dev->driver->gem_free_object_unlocked != NULL)
		dev->driver->gem_free_object_unlocked(obj);
	else if (dev->driver->gem_free_object != NULL) {
		mutex_lock(&dev->struct_mutex);
		dev->driver->gem_free_object(obj);
		mutex_unlock(&dev->struct_mutex);
	}
}
EXPORT_SYMBOL(drm_gem_object_free_unlocked);

static void drm_gem_object_ref_bug(struct kref *list_kref)
{
	BUG();
@@ -496,12 +474,8 @@ static void drm_gem_object_ref_bug(struct kref *list_kref)
 * called before drm_gem_object_free or we'll be touching
 * freed memory
 */
void
drm_gem_object_handle_free(struct kref *kref)
void drm_gem_object_handle_free(struct drm_gem_object *obj)
{
	struct drm_gem_object *obj = container_of(kref,
						  struct drm_gem_object,
						  handlecount);
	struct drm_device *dev = obj->dev;

	/* Remove any name for this object */
@@ -528,6 +502,10 @@ void drm_gem_vm_open(struct vm_area_struct *vma)
	struct drm_gem_object *obj = vma->vm_private_data;

	drm_gem_object_reference(obj);

	mutex_lock(&obj->dev->struct_mutex);
	drm_vm_open_locked(vma);
	mutex_unlock(&obj->dev->struct_mutex);
}
EXPORT_SYMBOL(drm_gem_vm_open);

@@ -535,7 +513,10 @@ void drm_gem_vm_close(struct vm_area_struct *vma)
{
	struct drm_gem_object *obj = vma->vm_private_data;

	drm_gem_object_unreference_unlocked(obj);
	mutex_lock(&obj->dev->struct_mutex);
	drm_vm_close_locked(vma);
	drm_gem_object_unreference(obj);
	mutex_unlock(&obj->dev->struct_mutex);
}
EXPORT_SYMBOL(drm_gem_vm_close);

+1 −1
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ int drm_gem_one_name_info(int id, void *ptr, void *data)

	seq_printf(m, "%6d %8zd %7d %8d\n",
		   obj->name, obj->size,
		   atomic_read(&obj->handlecount.refcount),
		   atomic_read(&obj->handle_count),
		   atomic_read(&obj->refcount.refcount));
	return 0;
}
+18 −10
Original line number Diff line number Diff line
@@ -433,15 +433,7 @@ static void drm_vm_open(struct vm_area_struct *vma)
	mutex_unlock(&dev->struct_mutex);
}

/**
 * \c close method for all virtual memory types.
 *
 * \param vma virtual memory area.
 *
 * Search the \p vma private data entry in drm_device::vmalist, unlink it, and
 * free it.
 */
static void drm_vm_close(struct vm_area_struct *vma)
void drm_vm_close_locked(struct vm_area_struct *vma)
{
	struct drm_file *priv = vma->vm_file->private_data;
	struct drm_device *dev = priv->minor->dev;
@@ -451,7 +443,6 @@ static void drm_vm_close(struct vm_area_struct *vma)
		  vma->vm_start, vma->vm_end - vma->vm_start);
	atomic_dec(&dev->vma_count);

	mutex_lock(&dev->struct_mutex);
	list_for_each_entry_safe(pt, temp, &dev->vmalist, head) {
		if (pt->vma == vma) {
			list_del(&pt->head);
@@ -459,6 +450,23 @@ static void drm_vm_close(struct vm_area_struct *vma)
			break;
		}
	}
}

/**
 * \c close method for all virtual memory types.
 *
 * \param vma virtual memory area.
 *
 * Search the \p vma private data entry in drm_device::vmalist, unlink it, and
 * free it.
 */
static void drm_vm_close(struct vm_area_struct *vma)
{
	struct drm_file *priv = vma->vm_file->private_data;
	struct drm_device *dev = priv->minor->dev;

	mutex_lock(&dev->struct_mutex);
	drm_vm_close_locked(vma);
	mutex_unlock(&dev->struct_mutex);
}

+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
static const struct file_operations i810_buffer_fops = {
	.open = drm_open,
	.release = drm_release,
	.unlocked_ioctl = drm_ioctl,
	.unlocked_ioctl = i810_ioctl,
	.mmap = i810_mmap_buffers,
	.fasync = drm_fasync,
};
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
static const struct file_operations i830_buffer_fops = {
	.open = drm_open,
	.release = drm_release,
	.unlocked_ioctl = drm_ioctl,
	.unlocked_ioctl = i830_ioctl,
	.mmap = i830_mmap_buffers,
	.fasync = drm_fasync,
};
Loading