From patchwork Fri Nov 9 12:26:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 1720401 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id D6E90DF264 for ; Fri, 9 Nov 2012 13:03:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 861D9A0DC4 for ; Fri, 9 Nov 2012 05:03:04 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp-outbound-2.vmware.com (smtp-outbound-2.vmware.com [208.91.2.13]) by gabe.freedesktop.org (Postfix) with ESMTP id C5778A0C52 for ; Fri, 9 Nov 2012 05:02:40 -0800 (PST) Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 1B2242896A; Fri, 9 Nov 2012 05:02:40 -0800 (PST) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 186BAB0693; Fri, 9 Nov 2012 05:02:40 -0800 (PST) Received: from localhost (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id 1FE33121544; Fri, 9 Nov 2012 05:02:59 -0800 (PST) X-Virus-Scanned: amavisd-new at zcs-prod-ext-mta-1.vmware.com Received: from zcs-prod-ext-mta-1.vmware.com ([127.0.0.1]) by localhost (zcs-prod-ext-mta-1.vmware.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vXrsoG18mC8I; Fri, 9 Nov 2012 05:02:59 -0800 (PST) Received: from vmlin1.localdomain (unknown [10.113.62.14]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA id B02D01219A3; Fri, 9 Nov 2012 04:26:54 -0800 (PST) From: Thomas Hellstrom To: airlied@redhat.com, airlied@gmail.com Subject: [PATCH 2/8] drm/vmwgfx: Make overlay code not require fifo at init time Date: Fri, 9 Nov 2012 13:26:12 +0100 Message-Id: <1352463978-3676-3-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1352463978-3676-1-git-send-email-thellstrom@vmware.com> References: <1352463978-3676-1-git-send-email-thellstrom@vmware.com> Cc: Thomas Hellstrom , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul Reviewed-by: Dmitry Torokhov --- 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 cb55b7b..87e39f6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c @@ -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; @@ -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) { @@ -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); @@ -492,7 +501,7 @@ out_unlock: 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; @@ -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); @@ -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;