From patchwork Tue Mar 15 07:29:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 8585911 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F3CB6C0553 for ; Tue, 15 Mar 2016 07:52:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C8952025B for ; Tue, 15 Mar 2016 07:52:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4C652201B9 for ; Tue, 15 Mar 2016 07:52:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC92E6E6C6; Tue, 15 Mar 2016 07:52:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.bahnhof.se (mx1.bahnhof.se [213.80.101.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33C976E6C4 for ; Tue, 15 Mar 2016 07:52:02 +0000 (UTC) Received: from localhost (mf.bahnhof.se [213.80.101.20]) by mx1-reinject (Postfix) with ESMTP id 7A11E458C6; Tue, 15 Mar 2016 08:30:20 +0100 (CET) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MF2) X-Spam-Score: -0.561 X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from mf2.bahnhof.se ([127.0.0.1]) by localhost (mf2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8nxk+HcYYvNT; Tue, 15 Mar 2016 08:30:20 +0100 (CET) Received: from mail.shipmail.org (h-5-150-198-217.na.cust.bahnhof.se [5.150.198.217]) by mf2.bahnhof.se (Postfix) with ESMTP id 156A9940282; Tue, 15 Mar 2016 08:30:20 +0100 (CET) Received: from mail.shipmail.org (lin0.kontor.shipmail.org [127.0.0.1]) by mail.shipmail.org (Postfix) with ESMTP id D19BA33807C; Tue, 15 Mar 2016 08:30:19 +0100 (CET) Received: from lin0.kontor.shipmail.org [127.0.0.1] by BitDefender SMTP Proxy on lin0.kontor.shipmail.org [127.0.0.1] for lin0.kontor.shipmail.org [127.0.0.1]; Tue, 15 Mar 2016 08:30:19 +0100 (CET) Received: from linvm2.localdomain (lin0.kontor.shipmail.org [127.0.0.1]) by mail.shipmail.org (Postfix) with ESMTP id 9DF6A338081; Tue, 15 Mar 2016 08:30:19 +0100 (CET) From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH 06/14] drm/vmwgfx: Add implicit framebuffer checks to the screen target code Date: Tue, 15 Mar 2016 08:29:56 +0100 Message-Id: <1458027004-3180-6-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458027004-3180-1-git-send-email-thellstrom@vmware.com> References: <1458027004-3180-1-git-send-email-thellstrom@vmware.com> X-BitDefender-Scanner: Mail not scanned due to license constraints Cc: Thomas Hellstrom X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Just like for screen objects, make sure we use only a single framebuffer for implicit placement. Signed-off-by: Thomas Hellstrom Reviewed-by: Sinclair Yeh --- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index c93af71..a5ab826 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -510,6 +510,7 @@ out_srf_unref: static int vmw_stdu_crtc_set_config(struct drm_mode_set *set) { struct vmw_private *dev_priv; + struct vmw_framebuffer *vfb; struct vmw_screen_target_display_unit *stdu; struct drm_display_mode *mode; struct drm_framebuffer *new_fb; @@ -529,6 +530,7 @@ static int vmw_stdu_crtc_set_config(struct drm_mode_set *set) new_fb = set->fb; dev_priv = vmw_priv(crtc->dev); turning_off = set->num_connectors == 0 || !mode || !new_fb; + vfb = (new_fb) ? vmw_framebuffer_to_vfb(new_fb) : NULL; if (set->num_connectors > 1) { DRM_ERROR("Too many connectors\n"); @@ -548,6 +550,14 @@ static int vmw_stdu_crtc_set_config(struct drm_mode_set *set) return -EINVAL; } + /* Only one active implicit frame-buffer at a time. */ + if (!turning_off && stdu->base.is_implicit && dev_priv->implicit_fb && + !(dev_priv->num_implicit == 1 && stdu->base.active_implicit) + && dev_priv->implicit_fb != vfb) { + DRM_ERROR("Multiple implicit framebuffers not supported.\n"); + return -EINVAL; + } + /* Since they always map one to one these are safe */ connector = &stdu->base.connector; encoder = &stdu->base.encoder; @@ -559,6 +569,7 @@ static int vmw_stdu_crtc_set_config(struct drm_mode_set *set) vmw_stdu_unpin_display(stdu); (void) vmw_stdu_update_st(dev_priv, stdu); + vmw_kms_del_active(dev_priv, &stdu->base); ret = vmw_stdu_destroy_st(dev_priv, stdu); if (ret) @@ -603,6 +614,7 @@ static int vmw_stdu_crtc_set_config(struct drm_mode_set *set) if (ret) return ret; + vmw_kms_add_active(dev_priv, &stdu->base, vfb); crtc->enabled = true; connector->encoder = encoder; encoder->crtc = crtc; @@ -644,13 +656,16 @@ static int vmw_stdu_crtc_page_flip(struct drm_crtc *crtc, dev_priv = vmw_priv(crtc->dev); stdu = vmw_crtc_to_stdu(crtc); - if (!stdu->defined) + if (!stdu->defined || !vmw_kms_crtc_flippable(dev_priv, crtc)) return -EINVAL; ret = vmw_stdu_bind_fb(dev_priv, crtc, &crtc->mode, new_fb); if (ret) return ret; + if (stdu->base.is_implicit) + vmw_kms_update_implicit_fb(dev_priv, crtc); + vclips.x = crtc->x; vclips.y = crtc->y; vclips.w = crtc->mode.hdisplay;