From patchwork Fri Jan 17 08:27:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 3502621 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 85E08C02DC for ; Fri, 17 Jan 2014 08:27:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC1432010C for ; Fri, 17 Jan 2014 08:27:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0228E20107 for ; Fri, 17 Jan 2014 08:27:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F16C105D68; Fri, 17 Jan 2014 00:27:40 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by gabe.freedesktop.org (Postfix) with ESMTP id 855B3105D68 for ; Fri, 17 Jan 2014 00:27:38 -0800 (PST) Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 66BA62816F for ; Fri, 17 Jan 2014 00:27:37 -0800 (PST) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 5DA69B0033 for ; Fri, 17 Jan 2014 00:27:37 -0800 (PST) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id 61D2CC0058; Fri, 17 Jan 2014 00:28:13 -0800 (PST) Received: from localhost.localdomain (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Fri, 17 Jan 2014 00:28:11 -0800 (PST) From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/vmwgfx: Invalidate surface on non-readback unbind Date: Fri, 17 Jan 2014 09:27:15 +0100 Message-Id: <1389947235-2728-1-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 1.8.3.2 Cc: linux-graphics-maintainer@vmware.com, Thomas Hellstrom 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@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jakob Bornecrantz Fixes error messages in vmware.log Signed-off-by: Jakob Bornecrantz Reviewed-by: Michael Banack Signed-off-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index a729b20..3bb3331 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -1043,15 +1043,19 @@ static int vmw_gb_surface_unbind(struct vmw_resource *res, } *cmd1; struct { SVGA3dCmdHeader header; - SVGA3dCmdBindGBSurface body; + SVGA3dCmdInvalidateGBSurface body; } *cmd2; + struct { + SVGA3dCmdHeader header; + SVGA3dCmdBindGBSurface body; + } *cmd3; uint32_t submit_size; uint8_t *cmd; BUG_ON(bo->mem.mem_type != VMW_PL_MOB); - submit_size = sizeof(*cmd2) + (readback ? sizeof(*cmd1) : 0); + submit_size = sizeof(*cmd3) + (readback ? sizeof(*cmd1) : sizeof(*cmd2)); cmd = vmw_fifo_reserve(dev_priv, submit_size); if (unlikely(cmd == NULL)) { DRM_ERROR("Failed reserving FIFO space for surface " @@ -1059,18 +1063,24 @@ static int vmw_gb_surface_unbind(struct vmw_resource *res, return -ENOMEM; } - cmd2 = (void *) cmd; if (readback) { cmd1 = (void *) cmd; cmd1->header.id = SVGA_3D_CMD_READBACK_GB_SURFACE; cmd1->header.size = sizeof(cmd1->body); cmd1->body.sid = res->id; - cmd2 = (void *) &cmd1[1]; + cmd3 = (void *) &cmd1[1]; + } else { + cmd2 = (void *) cmd; + cmd2->header.id = SVGA_3D_CMD_INVALIDATE_GB_SURFACE; + cmd2->header.size = sizeof(cmd2->body); + cmd2->body.sid = res->id; + cmd3 = (void *) &cmd2[1]; } - cmd2->header.id = SVGA_3D_CMD_BIND_GB_SURFACE; - cmd2->header.size = sizeof(cmd2->body); - cmd2->body.sid = res->id; - cmd2->body.mobid = SVGA3D_INVALID_ID; + + cmd3->header.id = SVGA_3D_CMD_BIND_GB_SURFACE; + cmd3->header.size = sizeof(cmd3->body); + cmd3->body.sid = res->id; + cmd3->body.mobid = SVGA3D_INVALID_ID; vmw_fifo_commit(dev_priv, submit_size);