Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5065120pxb; Mon, 15 Feb 2021 08:35:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxs0kQXRC7+IY9CBHyLgfUJsvWYyw9wbsvBWe9IoHpkK12HG/m6FNHx5GZvykGBznW6H3Jd X-Received: by 2002:a17:906:9b86:: with SMTP id dd6mr2636630ejc.516.1613406924818; Mon, 15 Feb 2021 08:35:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613406924; cv=none; d=google.com; s=arc-20160816; b=VlxpLgqHlzWijGzZUrMrOQzkBJdOfpezgk/6srTITPHOQUIIhFuq9pRjCGHmxjmfo/ FOEc+sEpMyxPEfOn7voBffjxPiaaU8+O60sdOGwKUlqcaKq9Q0TWwN/JeDyOD3MUiHYZ kNkiZOvIL0BSCOabV5jqKfNrOUnpYXAMVd7P1J/mFP80iCcULI/hDyih6wx1yx1cb49u /2VLy2f3gJy+KoWCJolXdeyxxxF+ZcoYHZsD1apP/TKeoLJwhNP7jBfVNqfSZ36HoNq5 eC+lJRSFTy15fCrPTCPCx5zKtQLOiJWcPaWJtJLCAXRreXE9jA2cgEJ8Y1qMWuCdqdm9 ThHw== 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=F74QjyuB2HpO/E8b3TRObqKw6r65iLwsQ3EJ+Mrgvv0=; b=FE7KDKg5oMOwWsaIfO6X6QSxAeEeJ7Xxgr1MZ9soV3EIzRB+RyAX5TB2hmtTOqVdfg ofRuB6eGzJZphRkeEJ7cjB3NOV5OGa5imueCd5eAGOWHKKBgsm0Ozl0he9HzXP+JjBvA 29TrjEu+l1uAVfAUSGXOWrdLAZhAbqNeHrXJ9og5BRYkDG1XHxSAvST+3eeQPTA3K7o8 yQNbWIfIlCWVg5hhOF1bnsjlsuCJOvH2lWbmohOfkJ7j52z/1TxsuK+1oYbt5qbHjQkI e7GQSqZNfx7aAHrqzo3pTvU9IIqp+dc8Dd/yjIRxOq7gZmHUt7eb43W9wVEkn2y5XBEr LNFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cvqda1xL; 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 a42si16558618edf.469.2021.02.15.08.35.01; Mon, 15 Feb 2021 08:35:24 -0800 (PST) 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=cvqda1xL; 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 S231261AbhBOQcK (ORCPT + 99 others); Mon, 15 Feb 2021 11:32:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:50210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231360AbhBOPhS (ORCPT ); Mon, 15 Feb 2021 10:37:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DA5464ED6; Mon, 15 Feb 2021 15:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403136; bh=UwJWluWcNg2b6jt/cHSlCJiCOzOKbIm8NV448JHNE84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvqda1xLN02MB28cbaOFt5EeJeu+6ZXblRW4Un6CJvswoa1qYqbNPkpMF55rhcsyZ Q9xznzuCBo85DlOOBqUegDdpnrRWrlPjImACMsJZ/4Rfvdq8Gas2ie7L7ZCRl00mT5 BOrcktB9Z/4F2wAMkeilRwIOCVqm+cFxfl1vt7gU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Wilson , Joonas Lahtinen , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula Subject: [PATCH 5.10 008/104] drm/i915: Fix overlay frontbuffer tracking Date: Mon, 15 Feb 2021 16:26:21 +0100 Message-Id: <20210215152719.736885823@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@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: Ville Syrjälä commit 5feba0e905c495a217aea9db4ea91093d8fe5dde upstream. We don't have a persistent fb holding a reference to the frontbuffer object, so every time we do the get+put we throw the frontbuffer object immediately away. And so the next time around we get a pristine frontbuffer object with bits==0 even for the old vma. This confuses the frontbuffer tracking code which understandably expects the old frontbuffer to have the overlay's bit set. Fix this by hanging on to the frontbuffer reference until the next flip. And just to make this a bit more clear let's track the frontbuffer explicitly instead of just grabbing it via the old vma. Cc: stable@vger.kernel.org Cc: Chris Wilson Cc: Joonas Lahtinen Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1136 Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20210209021918.16234-2-ville.syrjala@linux.intel.com Fixes: 8e7cb1799b4f ("drm/i915: Extract intel_frontbuffer active tracking") Reviewed-by: Chris Wilson (cherry picked from commit 553c23bdb4775130f333f07a51b047276bc53f79) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/display/intel_overlay.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) --- a/drivers/gpu/drm/i915/display/intel_overlay.c +++ b/drivers/gpu/drm/i915/display/intel_overlay.c @@ -182,6 +182,7 @@ struct intel_overlay { struct intel_crtc *crtc; struct i915_vma *vma; struct i915_vma *old_vma; + struct intel_frontbuffer *frontbuffer; bool active; bool pfit_active; u32 pfit_vscale_ratio; /* shifted-point number, (1<<12) == 1.0 */ @@ -282,21 +283,19 @@ static void intel_overlay_flip_prepare(s struct i915_vma *vma) { enum pipe pipe = overlay->crtc->pipe; - struct intel_frontbuffer *from = NULL, *to = NULL; + struct intel_frontbuffer *frontbuffer = NULL; drm_WARN_ON(&overlay->i915->drm, overlay->old_vma); - if (overlay->vma) - from = intel_frontbuffer_get(overlay->vma->obj); if (vma) - to = intel_frontbuffer_get(vma->obj); + frontbuffer = intel_frontbuffer_get(vma->obj); - intel_frontbuffer_track(from, to, INTEL_FRONTBUFFER_OVERLAY(pipe)); + intel_frontbuffer_track(overlay->frontbuffer, frontbuffer, + INTEL_FRONTBUFFER_OVERLAY(pipe)); - if (to) - intel_frontbuffer_put(to); - if (from) - intel_frontbuffer_put(from); + if (overlay->frontbuffer) + intel_frontbuffer_put(overlay->frontbuffer); + overlay->frontbuffer = frontbuffer; intel_frontbuffer_flip_prepare(overlay->i915, INTEL_FRONTBUFFER_OVERLAY(pipe));