diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2012-11-09 07:26:12 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-11-20 01:19:50 -0500 |
commit | dcb522715503dfd3eae4fe402439bd4737434f21 (patch) | |
tree | a00a5c8ce8221e17b7e06ac559df7b36c6953cb9 /drivers | |
parent | ba723fe8b7e88d86825862fa528a75f94b1ad8b1 (diff) |
drm/vmwgfx: Make overlay code not require fifo at init time
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dmitry Torokhov <dtor@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c index cb55b7b66377..87e39f68e9d0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "svga_escape.h" | 35 | #include "svga_escape.h" |
36 | 36 | ||
37 | #define VMW_MAX_NUM_STREAMS 1 | 37 | #define VMW_MAX_NUM_STREAMS 1 |
38 | #define VMW_OVERLAY_CAP_MASK (SVGA_FIFO_CAP_VIDEO | SVGA_FIFO_CAP_ESCAPE) | ||
38 | 39 | ||
39 | struct vmw_stream { | 40 | struct vmw_stream { |
40 | struct vmw_dma_buffer *buf; | 41 | struct vmw_dma_buffer *buf; |
@@ -449,6 +450,14 @@ int vmw_overlay_pause_all(struct vmw_private *dev_priv) | |||
449 | return 0; | 450 | return 0; |
450 | } | 451 | } |
451 | 452 | ||
453 | |||
454 | static bool vmw_overlay_available(const struct vmw_private *dev_priv) | ||
455 | { | ||
456 | return (dev_priv->overlay_priv != NULL && | ||
457 | ((dev_priv->fifo.capabilities & VMW_OVERLAY_CAP_MASK) == | ||
458 | VMW_OVERLAY_CAP_MASK)); | ||
459 | } | ||
460 | |||
452 | int vmw_overlay_ioctl(struct drm_device *dev, void *data, | 461 | int vmw_overlay_ioctl(struct drm_device *dev, void *data, |
453 | struct drm_file *file_priv) | 462 | struct drm_file *file_priv) |
454 | { | 463 | { |
@@ -461,7 +470,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, | |||
461 | struct vmw_resource *res; | 470 | struct vmw_resource *res; |
462 | int ret; | 471 | int ret; |
463 | 472 | ||
464 | if (!overlay) | 473 | if (!vmw_overlay_available(dev_priv)) |
465 | return -ENOSYS; | 474 | return -ENOSYS; |
466 | 475 | ||
467 | ret = vmw_user_stream_lookup(dev_priv, tfile, &arg->stream_id, &res); | 476 | ret = vmw_user_stream_lookup(dev_priv, tfile, &arg->stream_id, &res); |
@@ -492,7 +501,7 @@ out_unlock: | |||
492 | 501 | ||
493 | int vmw_overlay_num_overlays(struct vmw_private *dev_priv) | 502 | int vmw_overlay_num_overlays(struct vmw_private *dev_priv) |
494 | { | 503 | { |
495 | if (!dev_priv->overlay_priv) | 504 | if (!vmw_overlay_available(dev_priv)) |
496 | return 0; | 505 | return 0; |
497 | 506 | ||
498 | return VMW_MAX_NUM_STREAMS; | 507 | return VMW_MAX_NUM_STREAMS; |
@@ -503,7 +512,7 @@ int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv) | |||
503 | struct vmw_overlay *overlay = dev_priv->overlay_priv; | 512 | struct vmw_overlay *overlay = dev_priv->overlay_priv; |
504 | int i, k; | 513 | int i, k; |
505 | 514 | ||
506 | if (!overlay) | 515 | if (!vmw_overlay_available(dev_priv)) |
507 | return 0; | 516 | return 0; |
508 | 517 | ||
509 | mutex_lock(&overlay->mutex); | 518 | mutex_lock(&overlay->mutex); |
@@ -569,12 +578,6 @@ int vmw_overlay_init(struct vmw_private *dev_priv) | |||
569 | if (dev_priv->overlay_priv) | 578 | if (dev_priv->overlay_priv) |
570 | return -EINVAL; | 579 | return -EINVAL; |
571 | 580 | ||
572 | if (!(dev_priv->fifo.capabilities & SVGA_FIFO_CAP_VIDEO) && | ||
573 | (dev_priv->fifo.capabilities & SVGA_FIFO_CAP_ESCAPE)) { | ||
574 | DRM_INFO("hardware doesn't support overlays\n"); | ||
575 | return -ENOSYS; | ||
576 | } | ||
577 | |||
578 | overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); | 581 | overlay = kzalloc(sizeof(*overlay), GFP_KERNEL); |
579 | if (!overlay) | 582 | if (!overlay) |
580 | return -ENOMEM; | 583 | return -ENOMEM; |