aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2011-10-10 06:23:27 -0400
committerDave Airlie <airlied@redhat.com>2011-10-10 10:47:19 -0400
commit5438ae88d098c086cfb94be5327c49a04fc6bfd7 (patch)
tree7ab7c17c9efe7b4c7f1dd02b45fed4296ef19ced /drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
parent57c5ee79acba9582762c09c269e0e2ae1adf1b31 (diff)
vmwgfx: Wrap drm_read and drm_poll
Make sure the device is processing the fifo when these functions are called in case they might sleep waiting for an event. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index c0284a4784c9..97f23abeacda 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -282,3 +282,46 @@ out_no_copy:
282out_clips: 282out_clips:
283 return ret; 283 return ret;
284} 284}
285
286
287/**
288 * vmw_fops_poll - wrapper around the drm_poll function
289 *
290 * @filp: See the linux fops poll documentation.
291 * @wait: See the linux fops poll documentation.
292 *
293 * Wrapper around the drm_poll function that makes sure the device is
294 * processing the fifo if drm_poll decides to wait.
295 */
296unsigned int vmw_fops_poll(struct file *filp, struct poll_table_struct *wait)
297{
298 struct drm_file *file_priv = filp->private_data;
299 struct vmw_private *dev_priv =
300 vmw_priv(file_priv->minor->dev);
301
302 vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
303 return drm_poll(filp, wait);
304}
305
306
307/**
308 * vmw_fops_read - wrapper around the drm_read function
309 *
310 * @filp: See the linux fops read documentation.
311 * @buffer: See the linux fops read documentation.
312 * @count: See the linux fops read documentation.
313 * offset: See the linux fops read documentation.
314 *
315 * Wrapper around the drm_read function that makes sure the device is
316 * processing the fifo if drm_read decides to wait.
317 */
318ssize_t vmw_fops_read(struct file *filp, char __user *buffer,
319 size_t count, loff_t *offset)
320{
321 struct drm_file *file_priv = filp->private_data;
322 struct vmw_private *dev_priv =
323 vmw_priv(file_priv->minor->dev);
324
325 vmw_fifo_ping_host(dev_priv, SVGA_SYNC_GENERIC);
326 return drm_read(filp, buffer, count, offset);
327}