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

Commit 0b53dbff authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: kgsl: remove KGSL_IOCTL_WAKE from context destruction"

parents 1cc2d0cf c89fdd5e
Loading
Loading
Loading
Loading
+4 −26
Original line number Original line Diff line number Diff line
@@ -935,8 +935,6 @@ static int kgsl_release(struct inode *inodep, struct file *filep)
	struct kgsl_mem_entry *entry;
	struct kgsl_mem_entry *entry;
	int next = 0;
	int next = 0;


	bool have_active_count = false;

	filep->private_data = NULL;
	filep->private_data = NULL;


	mutex_lock(&device->mutex);
	mutex_lock(&device->mutex);
@@ -956,11 +954,6 @@ static int kgsl_release(struct inode *inodep, struct file *filep)
			 */
			 */


			if (_kgsl_context_get(context)) {
			if (_kgsl_context_get(context)) {
				if (!have_active_count) {
					result = kgsl_active_count_get(device);
					BUG_ON(result);
					have_active_count = true;
				}
				kgsl_context_detach(context);
				kgsl_context_detach(context);
				kgsl_context_put(context);
				kgsl_context_put(context);
			}
			}
@@ -995,9 +988,6 @@ static int kgsl_release(struct inode *inodep, struct file *filep)
	 */
	 */
	kgsl_cancel_events(device, dev_priv);
	kgsl_cancel_events(device, dev_priv);


	if (have_active_count)
		kgsl_active_count_put(device);

	result = kgsl_close_device(device);
	result = kgsl_close_device(device);
	mutex_unlock(&device->mutex);
	mutex_unlock(&device->mutex);


@@ -3220,7 +3210,6 @@ typedef long (*kgsl_ioctl_func_t)(struct kgsl_device_private *,
		{ .cmd = (_cmd), .func = (_func), .flags = (_flags) }
		{ .cmd = (_cmd), .func = (_func), .flags = (_flags) }


#define KGSL_IOCTL_LOCK		BIT(0)
#define KGSL_IOCTL_LOCK		BIT(0)
#define KGSL_IOCTL_WAKE		BIT(1)


static const struct {
static const struct {
	unsigned int cmd;
	unsigned int cmd;
@@ -3257,7 +3246,7 @@ static const struct {
			KGSL_IOCTL_LOCK),
			KGSL_IOCTL_LOCK),
	KGSL_IOCTL_FUNC(IOCTL_KGSL_DRAWCTXT_DESTROY,
	KGSL_IOCTL_FUNC(IOCTL_KGSL_DRAWCTXT_DESTROY,
			kgsl_ioctl_drawctxt_destroy,
			kgsl_ioctl_drawctxt_destroy,
			KGSL_IOCTL_LOCK | KGSL_IOCTL_WAKE),
			KGSL_IOCTL_LOCK),
	KGSL_IOCTL_FUNC(IOCTL_KGSL_MAP_USER_MEM,
	KGSL_IOCTL_FUNC(IOCTL_KGSL_MAP_USER_MEM,
			kgsl_ioctl_map_user_mem, 0),
			kgsl_ioctl_map_user_mem, 0),
	KGSL_IOCTL_FUNC(IOCTL_KGSL_SHAREDMEM_FROM_PMEM,
	KGSL_IOCTL_FUNC(IOCTL_KGSL_SHAREDMEM_FROM_PMEM,
@@ -3295,7 +3284,7 @@ static long kgsl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
	struct kgsl_device_private *dev_priv = filep->private_data;
	struct kgsl_device_private *dev_priv = filep->private_data;
	unsigned int nr;
	unsigned int nr;
	kgsl_ioctl_func_t func;
	kgsl_ioctl_func_t func;
	int lock, ret, use_hw = 0;
	int lock, ret;
	char ustack[64];
	char ustack[64];
	void *uptr = NULL;
	void *uptr = NULL;


@@ -3353,7 +3342,6 @@ static long kgsl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)


		func = kgsl_ioctl_funcs[nr].func;
		func = kgsl_ioctl_funcs[nr].func;
		lock = kgsl_ioctl_funcs[nr].flags & KGSL_IOCTL_LOCK;
		lock = kgsl_ioctl_funcs[nr].flags & KGSL_IOCTL_LOCK;
		use_hw = kgsl_ioctl_funcs[nr].flags & KGSL_IOCTL_WAKE;
	} else {
	} else {
		func = dev_priv->device->ftbl->ioctl;
		func = dev_priv->device->ftbl->ioctl;
		if (!func) {
		if (!func) {
@@ -3365,23 +3353,13 @@ static long kgsl_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
		lock = 1;
		lock = 1;
	}
	}


	if (lock) {
	if (lock)
		mutex_lock(&dev_priv->device->mutex);
		mutex_lock(&dev_priv->device->mutex);
		if (use_hw) {
			ret = kgsl_active_count_get(dev_priv->device);
			if (ret < 0)
				goto unlock;
		}
	}


	ret = func(dev_priv, cmd, uptr);
	ret = func(dev_priv, cmd, uptr);


unlock:
	if (lock)
	if (lock) {
		if (use_hw)
			kgsl_active_count_put(dev_priv->device);
		mutex_unlock(&dev_priv->device->mutex);
		mutex_unlock(&dev_priv->device->mutex);
	}


	/*
	/*
	 * Still copy back on failure, but assume function took
	 * Still copy back on failure, but assume function took
+6 −0
Original line number Original line Diff line number Diff line
@@ -919,12 +919,17 @@ z180_drawctxt_create(struct kgsl_device_private *dev_priv,
static int
static int
z180_drawctxt_detach(struct kgsl_context *context)
z180_drawctxt_detach(struct kgsl_context *context)
{
{
	int ret;
	struct kgsl_device *device;
	struct kgsl_device *device;
	struct z180_device *z180_dev;
	struct z180_device *z180_dev;


	device = context->device;
	device = context->device;
	z180_dev = Z180_DEVICE(device);
	z180_dev = Z180_DEVICE(device);


	ret = kgsl_active_count_get(device);
	if (ret)
		return ret;

	z180_idle(device);
	z180_idle(device);


	if (z180_dev->ringbuffer.prevctx == context->id) {
	if (z180_dev->ringbuffer.prevctx == context->id) {
@@ -936,6 +941,7 @@ z180_drawctxt_detach(struct kgsl_context *context)
				KGSL_MMUFLAGS_PTUPDATE);
				KGSL_MMUFLAGS_PTUPDATE);
	}
	}


	kgsl_active_count_put(device);
	return 0;
	return 0;
}
}