Commit 929e8d4a authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
  vmwgfx: Clip cliprects against screen boundaries in present and dirty
  vmwgfx: Resend the cursor after legacy modeset
  vmwgfx: Do better culling of presents
  vmwgfx: Refactor kms code to use vmw_user_lookup_handle helper
  vmwgfx: Add helper function to get surface or dmabuf
  vmwgfx: Refactor cursor update
  vmwgfx: Remove dmabuf check in present ioctl
  vmwgfx: Use the revised fifo hw version register when present
parents 62d7a292 6abff3c7
...@@ -390,6 +390,11 @@ extern int vmw_context_check(struct vmw_private *dev_priv, ...@@ -390,6 +390,11 @@ extern int vmw_context_check(struct vmw_private *dev_priv,
struct ttm_object_file *tfile, struct ttm_object_file *tfile,
int id, int id,
struct vmw_resource **p_res); struct vmw_resource **p_res);
extern int vmw_user_lookup_handle(struct vmw_private *dev_priv,
struct ttm_object_file *tfile,
uint32_t handle,
struct vmw_surface **out_surf,
struct vmw_dma_buffer **out_buf);
extern void vmw_surface_res_free(struct vmw_resource *res); extern void vmw_surface_res_free(struct vmw_resource *res);
extern int vmw_surface_init(struct vmw_private *dev_priv, extern int vmw_surface_init(struct vmw_private *dev_priv,
struct vmw_surface *srf, struct vmw_surface *srf,
......
...@@ -33,6 +33,7 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) ...@@ -33,6 +33,7 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv)
{ {
__le32 __iomem *fifo_mem = dev_priv->mmio_virt; __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
uint32_t fifo_min, hwversion; uint32_t fifo_min, hwversion;
const struct vmw_fifo_state *fifo = &dev_priv->fifo;
if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO)) if (!(dev_priv->capabilities & SVGA_CAP_EXTENDED_FIFO))
return false; return false;
...@@ -41,7 +42,12 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv) ...@@ -41,7 +42,12 @@ bool vmw_fifo_have_3d(struct vmw_private *dev_priv)
if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int)) if (fifo_min <= SVGA_FIFO_3D_HWVERSION * sizeof(unsigned int))
return false; return false;
hwversion = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION); hwversion = ioread32(fifo_mem +
((fifo->capabilities &
SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ?
SVGA_FIFO_3D_HWVERSION_REVISED :
SVGA_FIFO_3D_HWVERSION));
if (hwversion == 0) if (hwversion == 0)
return false; return false;
......
...@@ -58,8 +58,14 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, ...@@ -58,8 +58,14 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data,
case DRM_VMW_PARAM_FIFO_HW_VERSION: case DRM_VMW_PARAM_FIFO_HW_VERSION:
{ {
__le32 __iomem *fifo_mem = dev_priv->mmio_virt; __le32 __iomem *fifo_mem = dev_priv->mmio_virt;
const struct vmw_fifo_state *fifo = &dev_priv->fifo;
param->value = ioread32(fifo_mem + SVGA_FIFO_3D_HWVERSION);
param->value =
ioread32(fifo_mem +
((fifo->capabilities &
SVGA_FIFO_CAP_3D_HWVERSION_REVISED) ?
SVGA_FIFO_3D_HWVERSION_REVISED :
SVGA_FIFO_3D_HWVERSION));
break; break;
} }
default: default:
...@@ -166,13 +172,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, ...@@ -166,13 +172,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
ret = -EINVAL; ret = -EINVAL;
goto out_no_fb; goto out_no_fb;
} }
vfb = vmw_framebuffer_to_vfb(obj_to_fb(obj)); vfb = vmw_framebuffer_to_vfb(obj_to_fb(obj));
if (!vfb->dmabuf) {
DRM_ERROR("Framebuffer not dmabuf backed.\n");
ret = -EINVAL;
goto out_no_fb;
}
ret = ttm_read_lock(&vmaster->lock, true); ret = ttm_read_lock(&vmaster->lock, true);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
......
This diff is collapsed.
...@@ -62,9 +62,14 @@ struct vmw_framebuffer { ...@@ -62,9 +62,14 @@ struct vmw_framebuffer {
int vmw_cursor_update_image(struct vmw_private *dev_priv, int vmw_cursor_update_image(struct vmw_private *dev_priv,
u32 *image, u32 width, u32 height, u32 *image, u32 width, u32 height,
u32 hotspotX, u32 hotspotY); u32 hotspotX, u32 hotspotY);
int vmw_cursor_update_dmabuf(struct vmw_private *dev_priv,
struct vmw_dma_buffer *dmabuf,
u32 width, u32 height,
u32 hotspotX, u32 hotspotY);
void vmw_cursor_update_position(struct vmw_private *dev_priv, void vmw_cursor_update_position(struct vmw_private *dev_priv,
bool show, int x, int y); bool show, int x, int y);
/** /**
* Base class display unit. * Base class display unit.
* *
......
...@@ -74,9 +74,10 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) ...@@ -74,9 +74,10 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
{ {
struct vmw_legacy_display *lds = dev_priv->ldu_priv; struct vmw_legacy_display *lds = dev_priv->ldu_priv;
struct vmw_legacy_display_unit *entry; struct vmw_legacy_display_unit *entry;
struct vmw_display_unit *du = NULL;
struct drm_framebuffer *fb = NULL; struct drm_framebuffer *fb = NULL;
struct drm_crtc *crtc = NULL; struct drm_crtc *crtc = NULL;
int i = 0; int i = 0, ret;
/* If there is no display topology the host just assumes /* If there is no display topology the host just assumes
* that the guest will set the same layout as the host. * that the guest will set the same layout as the host.
...@@ -129,6 +130,25 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv) ...@@ -129,6 +130,25 @@ static int vmw_ldu_commit_list(struct vmw_private *dev_priv)
lds->last_num_active = lds->num_active; lds->last_num_active = lds->num_active;
/* Find the first du with a cursor. */
list_for_each_entry(entry, &lds->active, active) {
du = &entry->base;
if (!du->cursor_dmabuf)
continue;
ret = vmw_cursor_update_dmabuf(dev_priv,
du->cursor_dmabuf,
64, 64,
du->hotspot_x,
du->hotspot_y);
if (ret == 0)
break;
DRM_ERROR("Could not update cursor image\n");
}
return 0; return 0;
} }
......
...@@ -1190,6 +1190,29 @@ void vmw_resource_unreserve(struct list_head *list) ...@@ -1190,6 +1190,29 @@ void vmw_resource_unreserve(struct list_head *list)
write_unlock(lock); write_unlock(lock);
} }
/**
* Helper function that looks either a surface or dmabuf.
*
* The pointer this pointed at by out_surf and out_buf needs to be null.
*/
int vmw_user_lookup_handle(struct vmw_private *dev_priv,
struct ttm_object_file *tfile,
uint32_t handle,
struct vmw_surface **out_surf,
struct vmw_dma_buffer **out_buf)
{
int ret;
BUG_ON(*out_surf || *out_buf);
ret = vmw_user_surface_lookup_handle(dev_priv, tfile, handle, out_surf);
if (!ret)
return 0;
ret = vmw_user_dmabuf_lookup(tfile, handle, out_buf);
return ret;
}
int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv, int vmw_user_surface_lookup_handle(struct vmw_private *dev_priv,
struct ttm_object_file *tfile, struct ttm_object_file *tfile,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment