Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 345348
b: refs/heads/master
c: dcb5227
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Hellstrom authored and Dave Airlie committed Nov 20, 2012
1 parent be8c2d3 commit 3cd5abb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba723fe8b7e88d86825862fa528a75f94b1ad8b1
refs/heads/master: dcb522715503dfd3eae4fe402439bd4737434f21
21 changes: 12 additions & 9 deletions trunk/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "svga_escape.h"

#define VMW_MAX_NUM_STREAMS 1
#define VMW_OVERLAY_CAP_MASK (SVGA_FIFO_CAP_VIDEO | SVGA_FIFO_CAP_ESCAPE)

struct vmw_stream {
struct vmw_dma_buffer *buf;
Expand Down Expand Up @@ -449,6 +450,14 @@ int vmw_overlay_pause_all(struct vmw_private *dev_priv)
return 0;
}


static bool vmw_overlay_available(const struct vmw_private *dev_priv)
{
return (dev_priv->overlay_priv != NULL &&
((dev_priv->fifo.capabilities & VMW_OVERLAY_CAP_MASK) ==
VMW_OVERLAY_CAP_MASK));
}

int vmw_overlay_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
Expand All @@ -461,7 +470,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
struct vmw_resource *res;
int ret;

if (!overlay)
if (!vmw_overlay_available(dev_priv))
return -ENOSYS;

ret = vmw_user_stream_lookup(dev_priv, tfile, &arg->stream_id, &res);
Expand Down Expand Up @@ -492,7 +501,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,

int vmw_overlay_num_overlays(struct vmw_private *dev_priv)
{
if (!dev_priv->overlay_priv)
if (!vmw_overlay_available(dev_priv))
return 0;

return VMW_MAX_NUM_STREAMS;
Expand All @@ -503,7 +512,7 @@ int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv)
struct vmw_overlay *overlay = dev_priv->overlay_priv;
int i, k;

if (!overlay)
if (!vmw_overlay_available(dev_priv))
return 0;

mutex_lock(&overlay->mutex);
Expand Down Expand Up @@ -569,12 +578,6 @@ int vmw_overlay_init(struct vmw_private *dev_priv)
if (dev_priv->overlay_priv)
return -EINVAL;

if (!(dev_priv->fifo.capabilities & SVGA_FIFO_CAP_VIDEO) &&
(dev_priv->fifo.capabilities & SVGA_FIFO_CAP_ESCAPE)) {
DRM_INFO("hardware doesn't support overlays\n");
return -ENOSYS;
}

overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
if (!overlay)
return -ENOMEM;
Expand Down

0 comments on commit 3cd5abb

Please sign in to comment.