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

Commit 1a6e7601 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'vmwgfx-fixes-4.4-151208' of git://people.freedesktop.org/~thomash/linux into drm-fixes

Pull request of 2015-12-08

A couple of fixes for vmwgfx. A WARN() fix by Dan Carpenter,
a TTM read/write lock imbalance causing occasional hangs with Wayland and
an implementation of cursor_set2 to fix incorrectly offset Wayland cursors.

* tag 'vmwgfx-fixes-4.4-151208' of git://people.freedesktop.org/~thomash/linux:
  drm/vmwgfx: Implement the cursor_set2 callback v2
  drm/vmwgfx: fix a warning message
  drm/ttm: Fixed a read/write lock imbalance
parents ff6e0fd5 8fbf9d92
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -180,7 +180,7 @@ int ttm_write_lock(struct ttm_lock *lock, bool interruptible)
			spin_unlock(&lock->lock);
			spin_unlock(&lock->lock);
		}
		}
	} else
	} else
		wait_event(lock->queue, __ttm_read_lock(lock));
		wait_event(lock->queue, __ttm_write_lock(lock));


	return ret;
	return ret;
}
}
+1 −0
Original line number Original line Diff line number Diff line
@@ -1233,6 +1233,7 @@ static void vmw_master_drop(struct drm_device *dev,


	vmw_fp->locked_master = drm_master_get(file_priv->master);
	vmw_fp->locked_master = drm_master_get(file_priv->master);
	ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile);
	ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile);
	vmw_kms_legacy_hotspot_clear(dev_priv);
	if (unlikely((ret != 0))) {
	if (unlikely((ret != 0))) {
		DRM_ERROR("Unable to lock TTM at VT switch.\n");
		DRM_ERROR("Unable to lock TTM at VT switch.\n");
		drm_master_put(&vmw_fp->locked_master);
		drm_master_put(&vmw_fp->locked_master);
+1 −0
Original line number Original line Diff line number Diff line
@@ -925,6 +925,7 @@ int vmw_kms_present(struct vmw_private *dev_priv,
		    uint32_t num_clips);
		    uint32_t num_clips);
int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
				struct drm_file *file_priv);
				struct drm_file *file_priv);
void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv);


int vmw_dumb_create(struct drm_file *file_priv,
int vmw_dumb_create(struct drm_file *file_priv,
		    struct drm_device *dev,
		    struct drm_device *dev,
+1 −1
Original line number Original line Diff line number Diff line
@@ -390,7 +390,7 @@ void *vmw_fifo_reserve_dx(struct vmw_private *dev_priv, uint32_t bytes,
	else if (ctx_id == SVGA3D_INVALID_ID)
	else if (ctx_id == SVGA3D_INVALID_ID)
		ret = vmw_local_fifo_reserve(dev_priv, bytes);
		ret = vmw_local_fifo_reserve(dev_priv, bytes);
	else {
	else {
		WARN_ON("Command buffer has not been allocated.\n");
		WARN(1, "Command buffer has not been allocated.\n");
		ret = NULL;
		ret = NULL;
	}
	}
	if (IS_ERR_OR_NULL(ret)) {
	if (IS_ERR_OR_NULL(ret)) {
+51 −13
Original line number Original line Diff line number Diff line
@@ -133,13 +133,19 @@ void vmw_cursor_update_position(struct vmw_private *dev_priv,
	vmw_mmio_write(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT);
	vmw_mmio_write(++count, fifo_mem + SVGA_FIFO_CURSOR_COUNT);
}
}


int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,

			   uint32_t handle, uint32_t width, uint32_t height)
/*
 * vmw_du_crtc_cursor_set2 - Driver cursor_set2 callback.
 */
int vmw_du_crtc_cursor_set2(struct drm_crtc *crtc, struct drm_file *file_priv,
			    uint32_t handle, uint32_t width, uint32_t height,
			    int32_t hot_x, int32_t hot_y)
{
{
	struct vmw_private *dev_priv = vmw_priv(crtc->dev);
	struct vmw_private *dev_priv = vmw_priv(crtc->dev);
	struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
	struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
	struct vmw_surface *surface = NULL;
	struct vmw_surface *surface = NULL;
	struct vmw_dma_buffer *dmabuf = NULL;
	struct vmw_dma_buffer *dmabuf = NULL;
	s32 hotspot_x, hotspot_y;
	int ret;
	int ret;


	/*
	/*
@@ -151,6 +157,8 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
	 */
	 */
	drm_modeset_unlock_crtc(crtc);
	drm_modeset_unlock_crtc(crtc);
	drm_modeset_lock_all(dev_priv->dev);
	drm_modeset_lock_all(dev_priv->dev);
	hotspot_x = hot_x + du->hotspot_x;
	hotspot_y = hot_y + du->hotspot_y;


	/* A lot of the code assumes this */
	/* A lot of the code assumes this */
	if (handle && (width != 64 || height != 64)) {
	if (handle && (width != 64 || height != 64)) {
@@ -187,31 +195,34 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv,
		vmw_dmabuf_unreference(&du->cursor_dmabuf);
		vmw_dmabuf_unreference(&du->cursor_dmabuf);


	/* setup new image */
	/* setup new image */
	ret = 0;
	if (surface) {
	if (surface) {
		/* vmw_user_surface_lookup takes one reference */
		/* vmw_user_surface_lookup takes one reference */
		du->cursor_surface = surface;
		du->cursor_surface = surface;


		du->cursor_surface->snooper.crtc = crtc;
		du->cursor_surface->snooper.crtc = crtc;
		du->cursor_age = du->cursor_surface->snooper.age;
		du->cursor_age = du->cursor_surface->snooper.age;
		vmw_cursor_update_image(dev_priv, surface->snooper.image,
		ret = vmw_cursor_update_image(dev_priv, surface->snooper.image,
					64, 64, du->hotspot_x, du->hotspot_y);
					      64, 64, hotspot_x, hotspot_y);
	} else if (dmabuf) {
	} else if (dmabuf) {
		/* vmw_user_surface_lookup takes one reference */
		/* vmw_user_surface_lookup takes one reference */
		du->cursor_dmabuf = dmabuf;
		du->cursor_dmabuf = dmabuf;


		ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height,
		ret = vmw_cursor_update_dmabuf(dev_priv, dmabuf, width, height,
					       du->hotspot_x, du->hotspot_y);
					       hotspot_x, hotspot_y);
	} else {
	} else {
		vmw_cursor_update_position(dev_priv, false, 0, 0);
		vmw_cursor_update_position(dev_priv, false, 0, 0);
		ret = 0;
		goto out;
		goto out;
	}
	}


	if (!ret) {
		vmw_cursor_update_position(dev_priv, true,
		vmw_cursor_update_position(dev_priv, true,
				   du->cursor_x + du->hotspot_x,
					   du->cursor_x + hotspot_x,
				   du->cursor_y + du->hotspot_y);
					   du->cursor_y + hotspot_y);
		du->core_hotspot_x = hot_x;
		du->core_hotspot_y = hot_y;
	}


	ret = 0;
out:
out:
	drm_modeset_unlock_all(dev_priv->dev);
	drm_modeset_unlock_all(dev_priv->dev);
	drm_modeset_lock_crtc(crtc, crtc->cursor);
	drm_modeset_lock_crtc(crtc, crtc->cursor);
@@ -239,8 +250,10 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
	drm_modeset_lock_all(dev_priv->dev);
	drm_modeset_lock_all(dev_priv->dev);


	vmw_cursor_update_position(dev_priv, shown,
	vmw_cursor_update_position(dev_priv, shown,
				   du->cursor_x + du->hotspot_x,
				   du->cursor_x + du->hotspot_x +
				   du->cursor_y + du->hotspot_y);
				   du->core_hotspot_x,
				   du->cursor_y + du->hotspot_y +
				   du->core_hotspot_y);


	drm_modeset_unlock_all(dev_priv->dev);
	drm_modeset_unlock_all(dev_priv->dev);
	drm_modeset_lock_crtc(crtc, crtc->cursor);
	drm_modeset_lock_crtc(crtc, crtc->cursor);
@@ -334,6 +347,29 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf,
	ttm_bo_unreserve(bo);
	ttm_bo_unreserve(bo);
}
}


/**
 * vmw_kms_legacy_hotspot_clear - Clear legacy hotspots
 *
 * @dev_priv: Pointer to the device private struct.
 *
 * Clears all legacy hotspots.
 */
void vmw_kms_legacy_hotspot_clear(struct vmw_private *dev_priv)
{
	struct drm_device *dev = dev_priv->dev;
	struct vmw_display_unit *du;
	struct drm_crtc *crtc;

	drm_modeset_lock_all(dev);
	drm_for_each_crtc(crtc, dev) {
		du = vmw_crtc_to_du(crtc);

		du->hotspot_x = 0;
		du->hotspot_y = 0;
	}
	drm_modeset_unlock_all(dev);
}

void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
{
{
	struct drm_device *dev = dev_priv->dev;
	struct drm_device *dev = dev_priv->dev;
@@ -351,7 +387,9 @@ void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv)
		du->cursor_age = du->cursor_surface->snooper.age;
		du->cursor_age = du->cursor_surface->snooper.age;
		vmw_cursor_update_image(dev_priv,
		vmw_cursor_update_image(dev_priv,
					du->cursor_surface->snooper.image,
					du->cursor_surface->snooper.image,
					64, 64, du->hotspot_x, du->hotspot_y);
					64, 64,
					du->hotspot_x + du->core_hotspot_x,
					du->hotspot_y + du->core_hotspot_y);
	}
	}


	mutex_unlock(&dev->mode_config.mutex);
	mutex_unlock(&dev->mode_config.mutex);
Loading