Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2836250pxv; Mon, 12 Jul 2021 03:08:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyM9FCbiJ5Sjeq44YkMlYJFc+9EKct7ARnvHWjLiJgll6laGNwFZowpZBgQRgqxVNpcBaQj X-Received: by 2002:a05:6638:d0e:: with SMTP id q14mr349880jaj.13.1626084444593; Mon, 12 Jul 2021 03:07:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084444; cv=none; d=google.com; s=arc-20160816; b=s6n2EAC0cjV+wvShJmfnO/BBg4JEMo5gthPUp65gLKDYCIcIREc5Lh/RDM/wyKC7/z PeM4br75ensCIg/AmsQJP19f4eXbVe2vexRvR/fIgu4irwGKd0/YgSEmzlVnosqeIP6g ZolYepz1k6UmfdK+SXkekfaxX4zb8mT4kbIn6YQ+yba7lGoDq8GZcAcuksL9rnKBIOKG UxWg3KKq/+pmo1NvYO5yLJKyuznEfQrT4318u0cMBJo8k3xFJTJay4I0fy5mYnBFSzdC 4bNhjkx0iC/sPV9So46tQIQUybHG0OdSvUQ2pxtuZzCO/lWyn16zQ6yBcFFFxwS76DYu ruoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V9NttxwYSIzG86SyMW0n8XEjxrQSysQIWR+Vd5Nx35c=; b=jfVt2mOUx81MRlSzLMXV1z0RE5xN+HoK0lGrC9Z8Cb4Oki9EceJEuxg1kQLI3mFAwW RHny8PThImsUaj4ncb/pT52wdxQMBR4/m2XIIty7PAxt9yPROOOOIRS6Tf8oQgNThcbO dmNIbu2efGcF5r6VjY307oTUI5dxHMp8aWOgkD3f/3bA25tcLun2Fmpi0tIEG0mk22vJ YeDKxRBbTbJd21pw59ciPGIFhlG7Tc8bf3JO1OAVgWGkIDqZQjveC47Ftz18TPv0ImqA IU7foNIQ+yUyfY0MNtSuXd6L5WAgP+hVKj+TllwTBG12IF9hbKKoXA7WS3y8i2Go5OEd XLQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zoasqb0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si16272636iol.39.2021.07.12.03.07.13; Mon, 12 Jul 2021 03:07:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zoasqb0b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346090AbhGLHps (ORCPT + 99 others); Mon, 12 Jul 2021 03:45:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:48022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242273AbhGLHMt (ORCPT ); Mon, 12 Jul 2021 03:12:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 583656121F; Mon, 12 Jul 2021 07:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626073798; bh=zaMRwwlAbN2z8547stVg/bCNxuPecA7udsrzrBbxcNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zoasqb0bgjZAWrEQhHMQzYVbIdPS1T7yguCzih2D1fxargHy8HHiRWzw1OsF4EuMf iiERgR4wV/6D+kgQGGkTE2mg+24z+MlbVVfX8cFwU7YlhdQi8EqrK+apG6CutD086X UxMbNwHu3xYL3DG13267dzFTpSvODPsRiAvBkg+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Hellstrom , Charmaine Lee , Roland Scheidegger , Zack Rusin , Sasha Levin Subject: [PATCH 5.12 364/700] drm/vmwgfx: Mark a surface gpu-dirty after the SVGA3dCmdDXGenMips command Date: Mon, 12 Jul 2021 08:07:27 +0200 Message-Id: <20210712061015.094101341@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Hellstrom [ Upstream commit 75156a887b6cea6e09d83ec19f4ebfd7c86265f0 ] The SVGA3dCmdDXGenMips command uses a shader-resource view to access the underlying surface. Normally accesses using that view-type are not dirtying the underlying surface, but that particular command is an exception. Mark the surface gpu-dirty after a SVGA3dCmdDXGenMips command has been submitted. This fixes the piglit getteximage-formats test run with SVGA_FORCE_COHERENT=1 Fixes: a9f58c456e9d ("drm/vmwgfx: Be more restrictive when dirtying resources") Signed-off-by: Thomas Hellstrom Reviewed-by: Charmaine Lee Reviewed-by: Roland Scheidegger Signed-off-by: Zack Rusin Link: https://patchwork.freedesktop.org/patch/msgid/20210505035740.286923-3-zackr@vmware.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c index 462f17320708..0996c3282ebd 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -2759,12 +2759,24 @@ static int vmw_cmd_dx_genmips(struct vmw_private *dev_priv, { VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdDXGenMips) = container_of(header, typeof(*cmd), header); - struct vmw_resource *ret; + struct vmw_resource *view; + struct vmw_res_cache_entry *rcache; - ret = vmw_view_id_val_add(sw_context, vmw_view_sr, - cmd->body.shaderResourceViewId); + view = vmw_view_id_val_add(sw_context, vmw_view_sr, + cmd->body.shaderResourceViewId); + if (IS_ERR(view)) + return PTR_ERR(view); - return PTR_ERR_OR_ZERO(ret); + /* + * Normally the shader-resource view is not gpu-dirtying, but for + * this particular command it is... + * So mark the last looked-up surface, which is the surface + * the view points to, gpu-dirty. + */ + rcache = &sw_context->res_cache[vmw_res_surface]; + vmw_validation_res_set_dirty(sw_context->ctx, rcache->private, + VMW_RES_DIRTY_SET); + return 0; } /** -- 2.30.2