From patchwork Sun Nov 19 10:56:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 166753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1592706vqn; Sun, 19 Nov 2023 02:57:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQFVJ80wCKvGBTg41JF17hv0jR7HqIPbndemofDAw0/38Ym3PWLGgg/LmQMmWnNTWXK59W X-Received: by 2002:a05:6358:52c3:b0:168:cfea:2d41 with SMTP id z3-20020a05635852c300b00168cfea2d41mr5166958rwz.14.1700391454878; Sun, 19 Nov 2023 02:57:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700391454; cv=none; d=google.com; s=arc-20160816; b=nY5U67C0qbztwEIXANWcwTjPssMO4viF0Zx7ctW12XOGQt0vb+fzZtbRLLMyZteOWH wUoiGjGKEECeklV3ad92wWNCovpOBeQS0Y3qQ1n1Sm//1Fl7qGuUHSa1Q1S2R94AkE7R yAMJ9kylE0IoyAGjHw6zkYghh0uQBdhu0ENOtoDnHHHA7QLI+AViweeR0q+7OQWMruFp Uz5SbjkTTsm+v9jezUEOiEQRkjTnjZ8nv+8wmYbPhOMwO+cubO4b4RZvd0eCVHXqfNrL 7rqih181wfzWcxMcDOwjKjfr2+mzajhwVagimD+rHXx+m5DUFmucmkAK3fVOJRLXQOre pEow== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wduLhA1JfH2JIibNOg1UP/hJXljazR5AfhyG/qLMjyE=; fh=Ewr6KfxP7wygPDpTWkF0i9HI6ykdUwgNefoN1mtEwQY=; b=lMCjarzr2SaEcGXUQ2J2XnosLljkJqnFkkqlPrJNVjOEHQ4/hDzOTY9nq2HPap2RAP 8bcdAVcadsbyO7+6R2iXELM4nChcjfa100DxzwzjpmEKU8ZxsgNe0P7fKrowBxsd+fnh qRleH3qhREVK+Lm6w1UZqp9+geKdYAUG/WmlYwRz/WFjyw/6vQsZVVp9DXZ8FKsxI1cr bZ460AhkUQfgh628+n7SSiqnlFBYal/v551eq1M79f87NpogLCHUYN8BIdpY0j7MeAHC FEB1Rz8u28gHKjZrR2dJOAg4afcEcs5OLUhhJRUv5Owic1N23DcFX4EhdjQ6gXpypUTm ovzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="R/m4g8Q6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id bo7-20020a056a02038700b005b9b45ba3c1si6633554pgb.563.2023.11.19.02.57.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="R/m4g8Q6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D631380A73CA; Sun, 19 Nov 2023 02:57:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230437AbjKSK5a (ORCPT + 99 others); Sun, 19 Nov 2023 05:57:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbjKSK50 (ORCPT ); Sun, 19 Nov 2023 05:57:26 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7D36C6 for ; Sun, 19 Nov 2023 02:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700391441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wduLhA1JfH2JIibNOg1UP/hJXljazR5AfhyG/qLMjyE=; b=R/m4g8Q6Ky1f49aAV1MFbRQGJKisurwHi9YDCzQJk0MI8OjF/72L5KFOZ0p75LBKcvWra2 mge3A/V6wWF4VFnhnMVOZTmRrthOPVMsqsL9HfwtoXgIQOKbf3maoNOIUFj98Rl3P1jicf hGj3dLVuJxc6xrOWQNUU/qDbKQGIK4w= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-395-9ymYD9FXM76kk8t-nb1n0Q-1; Sun, 19 Nov 2023 05:57:20 -0500 X-MC-Unique: 9ymYD9FXM76kk8t-nb1n0Q-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4090fa518bbso6427565e9.2 for ; Sun, 19 Nov 2023 02:57:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700391438; x=1700996238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wduLhA1JfH2JIibNOg1UP/hJXljazR5AfhyG/qLMjyE=; b=J0dH6WZYHTZvUHTcS7k/But2D3eLfFo+f5oJ3kfbl0F+RX7FK1m7op4KUwsyAmOzZO wAjH3U/IYYm7T0kR8g7tRL/hs2Q72Xybst1Lcq07aAfwBS/3f5BI4F4unGi9aDyUrM91 7UXb6z6UAQDHE7gOwIt0bbtrKgtHSsbDHEFLaQSmzTM8VRiDsXjnaOxX/mcL8UAJBdgM uDxABZRhUHyBZvwQ8hKZwqPEB1XDixJV821sQe9Kv8/oFpV3QjZn77JfnfU1Zk5b89q7 +75TwmW3W6dKv+8/zv0FeFLzoete5hC9iLvMR6pWcT7ttCbQSg/Zs9TpN96kwPSDyad5 R2jw== X-Gm-Message-State: AOJu0YxgkOboWNhX+Ypoeh89TaHNsMAZ/ZCCQ3yZF7rRXWDGtfSUk7Ih EZomU06/MeU9gfTpxL3nMBnQfMz/o7pArkoziPnR3YvzsY8TRcT4Ge0y/c1AcqM8ZPwtkXcErOT Mo+LuAuJYofvOBfIW8bb8C+19wTZXCYFIM0UsYanPYSs2uIflqCX3mPsqFlPqSQY3YT4a4Qnq7W XClHTHgyA= X-Received: by 2002:a05:600c:5254:b0:408:40e2:773b with SMTP id fc20-20020a05600c525400b0040840e2773bmr3874945wmb.34.1700391438651; Sun, 19 Nov 2023 02:57:18 -0800 (PST) X-Received: by 2002:a05:600c:5254:b0:408:40e2:773b with SMTP id fc20-20020a05600c525400b0040840e2773bmr3874914wmb.34.1700391438309; Sun, 19 Nov 2023 02:57:18 -0800 (PST) Received: from localhost (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id t13-20020a05600c450d00b004094e565e71sm9510932wmo.23.2023.11.19.02.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 02:57:17 -0800 (PST) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: Thomas Zimmermann , Maxime Ripard , Pekka Paalanen , Sima Vetter , Erico Nunes , Simon Ser , Bilal Elmoussaoui , Javier Martinez Canillas , stable@vger.kernel.org, nerdopolis , Chia-I Wu , Daniel Vetter , David Airlie , Gerd Hoffmann , Gurchetan Singh , Maarten Lankhorst , dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev Subject: [PATCH v3 2/5] drm/virtio: Disable damage clipping if FB changed since last page-flip Date: Sun, 19 Nov 2023 11:56:58 +0100 Message-ID: <20231119105709.3143489-3-javierm@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231119105709.3143489-1-javierm@redhat.com> References: <20231119105709.3143489-1-javierm@redhat.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 19 Nov 2023 02:57:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782989670452481082 X-GMAIL-MSGID: 1782989670452481082 The driver does per-buffer uploads and needs to force a full plane update if the plane's attached framebuffer has change since the last page-flip. Fixes: 01f05940a9a7 ("drm/virtio: Enable fb damage clips property for the primary plane") Cc: # v6.4+ Reported-by: nerdopolis Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218115 Suggested-by: Sima Vetter Signed-off-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann --- (no changes since v2) Changes in v2: - Set struct drm_plane_state .ignore_damage_clips in virtio-gpu plane's .atomic_check instead of using a different helpers (Thomas Zimmermann). drivers/gpu/drm/virtio/virtgpu_plane.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/virtio/virtgpu_plane.c b/drivers/gpu/drm/virtio/virtgpu_plane.c index a2e045f3a000..a1ef657eba07 100644 --- a/drivers/gpu/drm/virtio/virtgpu_plane.c +++ b/drivers/gpu/drm/virtio/virtgpu_plane.c @@ -79,6 +79,8 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane, { struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state, plane); + struct drm_plane_state *old_plane_state = drm_atomic_get_old_plane_state(state, + plane); bool is_cursor = plane->type == DRM_PLANE_TYPE_CURSOR; struct drm_crtc_state *crtc_state; int ret; @@ -86,6 +88,14 @@ static int virtio_gpu_plane_atomic_check(struct drm_plane *plane, if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) return 0; + /* + * Ignore damage clips if the framebuffer attached to the plane's state + * has changed since the last plane update (page-flip). In this case, a + * full plane update should happen because uploads are done per-buffer. + */ + if (old_plane_state->fb != new_plane_state->fb) + new_plane_state->ignore_damage_clips = true; + crtc_state = drm_atomic_get_crtc_state(state, new_plane_state->crtc); if (IS_ERR(crtc_state))