Commit dcb52271 authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Dave Airlie

drm/vmwgfx: Make overlay code not require fifo at init time

Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarBrian Paul <brianp@vmware.com>
Reviewed-by: default avatarDmitry Torokhov <dtor@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent ba723fe8
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "svga_escape.h" #include "svga_escape.h"
#define VMW_MAX_NUM_STREAMS 1 #define VMW_MAX_NUM_STREAMS 1
#define VMW_OVERLAY_CAP_MASK (SVGA_FIFO_CAP_VIDEO | SVGA_FIFO_CAP_ESCAPE)
struct vmw_stream { struct vmw_stream {
struct vmw_dma_buffer *buf; struct vmw_dma_buffer *buf;
...@@ -449,6 +450,14 @@ int vmw_overlay_pause_all(struct vmw_private *dev_priv) ...@@ -449,6 +450,14 @@ int vmw_overlay_pause_all(struct vmw_private *dev_priv)
return 0; 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, int vmw_overlay_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
...@@ -461,7 +470,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, ...@@ -461,7 +470,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
struct vmw_resource *res; struct vmw_resource *res;
int ret; int ret;
if (!overlay) if (!vmw_overlay_available(dev_priv))
return -ENOSYS; return -ENOSYS;
ret = vmw_user_stream_lookup(dev_priv, tfile, &arg->stream_id, &res); ret = vmw_user_stream_lookup(dev_priv, tfile, &arg->stream_id, &res);
...@@ -492,7 +501,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, ...@@ -492,7 +501,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data,
int vmw_overlay_num_overlays(struct vmw_private *dev_priv) int vmw_overlay_num_overlays(struct vmw_private *dev_priv)
{ {
if (!dev_priv->overlay_priv) if (!vmw_overlay_available(dev_priv))
return 0; return 0;
return VMW_MAX_NUM_STREAMS; return VMW_MAX_NUM_STREAMS;
...@@ -503,7 +512,7 @@ int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv) ...@@ -503,7 +512,7 @@ int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv)
struct vmw_overlay *overlay = dev_priv->overlay_priv; struct vmw_overlay *overlay = dev_priv->overlay_priv;
int i, k; int i, k;
if (!overlay) if (!vmw_overlay_available(dev_priv))
return 0; return 0;
mutex_lock(&overlay->mutex); mutex_lock(&overlay->mutex);
...@@ -569,12 +578,6 @@ int vmw_overlay_init(struct vmw_private *dev_priv) ...@@ -569,12 +578,6 @@ int vmw_overlay_init(struct vmw_private *dev_priv)
if (dev_priv->overlay_priv) if (dev_priv->overlay_priv)
return -EINVAL; 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); overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
if (!overlay) if (!overlay)
return -ENOMEM; return -ENOMEM;
......
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