Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp275753rbb; Fri, 23 Feb 2024 23:15:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWWB6Dn+SnnW6hneqqQ4QQl6XuVCCy4R+LDLIK4nsAAkULxwwupD9ARsapeFwnxSby24mVInO36lKBFbvvbuWCqC9sMyGuibIKh3P1Otg== X-Google-Smtp-Source: AGHT+IErIkf0WPmmTnaWWVIvHVrEiYvC8oNev71+FruZa0erUE8n7FDhMbrlNHq26NoKeL6rBBG6 X-Received: by 2002:a05:6358:8099:b0:17b:5759:82ea with SMTP id a25-20020a056358809900b0017b575982eamr2485387rwk.11.1708758927752; Fri, 23 Feb 2024 23:15:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708758927; cv=pass; d=google.com; s=arc-20160816; b=fyqvVI0deQDkoIrssLR77jsGkTtNI5iIUq8fuNMrjSkm7xeZp48yRD8ca+bW8kvRpm G88IOd4JDxLsvA39Eg6rND+jJ1sNMnz5v4778VrPrftT8XmVHogOHY7CXl25ubXbN22M 4G24aVUFcv1p+/VCtreR4h0WWi5/L9bUlFZCjWTBZkYCgfau2FudUyRz3uboDtHGwxDU UOeVKkgbCdYYnKmApXxcrAZel56oAgOAoMxOfjRtw0Au5SyF+M+qKRheisJCgk5pUT5y YQyXlD9ebeoclJws2Unw3pyoo7OESzCtWMId/E8urb7zYO1aW2Sda12bd+DMKvPnOlRb BwAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=Q/l3rdHHadZ15R5gzk5CAjldRNRZfc44ldL/qVb2ZY4=; fh=syxxVS9nDzMCNklvcwqleQxRFtuZCpr4piGjkSsSARY=; b=CA8fCtlESDFTEEmT0jJu23HtI1+bhxnpCT7KFQtcLQwax+C25BZ882MaybR3AP+k0h jBteu+XKAxL1RfUD4tvT1+g2xkzrNgdZM6MtDmCjnZ3Igo0g9oB2bffGRQx4Dftl/Boj 6WS//cSjyjBPh4r93kO4K86dR9Crec1YSczqdgXpxPN6J2Qh+sif1lBRVFBBump+QY3u rd35AIKYLCOt1j3awghf0dpvwehqkVyljomfFiCtaE8m4TdCHHPVDckzICOBKvC7KTEO APQW6FnDR96Au4BdxvhCWddThdLGGOuZTsrV4TkWackA7pqNfbAJUTt7VXAMT6gTF28d m4tQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QvNw15f0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79497-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o9-20020a634e49000000b005e438ff32f9si528832pgl.394.2024.02.23.23.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 23:15:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79497-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QvNw15f0; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-79497-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79497-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5154B284ACE for ; Sat, 24 Feb 2024 07:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 344FE1118F; Sat, 24 Feb 2024 07:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QvNw15f0" Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DA19D52F for ; Sat, 24 Feb 2024 07:15:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708758920; cv=none; b=Qvid77Og/G3k0Y21RM1vDJuUXTvMdluRIsODBd1JOkV1jnXin6BbXRDOUsy7dqqlwzlY+WONZdyiSKs/l7mcEPsraIWsUWPfGsCkSBGHwnPxvokDq85WZUZphLqtJ5kuhfwq0dGlao/18Zl7D4mu76Hkoh1UHqqFsrvNBnQZk8c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708758920; c=relaxed/simple; bh=0HAot224t49qJekPYxrS9uVB+eTCHcXufJIXNedY8jg=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BFzrO9nqH5MTLRY6dNs4c9x/uM9DHzhn8r/7tBquJvPU23tDNaVPySNDSczcMMnp3lhDqw/7y3Ad8DPEPQBb81JnxG2D656MOrJ0+QgHsQmrueZ1vaoNwtZeW2v1gxxSnQVgYHSG6ANyXfvUdvzQ6LhLW8SJEKBeL7X+O8mLTqs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QvNw15f0; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-a3e8c1e4aa7so148807466b.2 for ; Fri, 23 Feb 2024 23:15:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708758917; x=1709363717; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Q/l3rdHHadZ15R5gzk5CAjldRNRZfc44ldL/qVb2ZY4=; b=QvNw15f0fh9yL1sQ1qojMMQah4nht1Om+nDBLEFEosOlCof9MJT50aNP0lGI1EbEsK N2MNs/4KEbCqVvRNb+toayU3W4RFImulYUPTrRdldkMVZcH38ctUZdPbSfDy/rU2clQ+ H59YNTtHekq9YDzUzm4MmM7nUdlUsdAje7ZdSnGezRyVOY89DqAT3ksv3gUaNP2fW/kW 2jUVsK4L1F8w667ZQuSeJL96lmIlcCDkPKfUar4kQUkEq8M3bxQXREaPBcjYqjwnt1+5 NwMGXnhQN+Xd9OpG0GZzjS9gzYoFLnyCHnk8hnTEZUB/eaDK48dBRRpGhQB8px+U9jC1 V7qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708758917; x=1709363717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q/l3rdHHadZ15R5gzk5CAjldRNRZfc44ldL/qVb2ZY4=; b=vSkxFUPXp+2ZFg+w5JdIBTSFZcUK9wrtqrKp5d1jXRWuJ1XLh9Y140GKHJXyvLTmK+ KJ98Pwe5pDxN9oePVMufzMnlgKdwMryjw8ccCVchyYZATf3+5P9qH4dFDZzuBkt/gp7q jGmpQ3+l98KcvDWVR1iVNe1TStw5ncKrse7lBJemqvZLw7gBX9IjLwu3q2QB4FV3g+X6 250v7AwIgx1WldChbSWkUh12W4HS+08zjXySmX5x0G6FSUscDAvqCr2Nix9yUPDOtPnc su3YFzxu4mNDt5uWV0YBqUaYzNExRyRJVd0lO70GZv3KKYoPlaUxxCQmm8Wwa1K88wVf GJ4w== X-Forwarded-Encrypted: i=1; AJvYcCX8gBK50iLCVXAAYUjdYw/h/sGBQ3PMgUMea/BC21TC8w/8a1ICF7LDJiCfKS6TWdrPWAWYJ2y3emcg0Iz6BLiHMBG7c7XnzQvEe3Zt X-Gm-Message-State: AOJu0YzrF+LUsVyX7g+NrvGiD5CuLPMh4fmGjocLhMclz9ORa3XoiPRr RXJIFG70V861GM7YfFTKAjKcsB125HdjSL+4Ytw1mK0kxkynz/Jg X-Received: by 2002:a17:906:5910:b0:a3f:583c:b00c with SMTP id h16-20020a170906591000b00a3f583cb00cmr1144362ejq.43.1708758916491; Fri, 23 Feb 2024 23:15:16 -0800 (PST) Received: from archlinux.localnet (86-58-6-171.dynamic.telemach.net. [86.58.6.171]) by smtp.gmail.com with ESMTPSA id jx20-20020a170906ca5400b00a3d777aa8fesm322779ejb.69.2024.02.23.23.15.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 23:15:15 -0800 (PST) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: =?utf-8?B?T25kxZllag==?= Jirman , Maxime Ripard , Chen-Yu Tsai , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Samuel Holland , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej =?utf-8?B?xaBrcmFiZWM=?= Subject: Re: [PATCH 3/3] drm/sun4i: Fix layer zpos change/atomic modesetting Date: Sat, 24 Feb 2024 08:10:05 +0100 Message-ID: <6018948.lOV4Wx5bFT@archlinux> In-Reply-To: <5h7jcwsdlpe7w2xylbhlw2asfww3znqlmlnszwvvosz5ssokkq@dxhn4v4sy4nq> References: <20240216190430.1374132-1-megi@xff.cz> <2448947.jE0xQCEvom@jernej-laptop> <5h7jcwsdlpe7w2xylbhlw2asfww3znqlmlnszwvvosz5ssokkq@dxhn4v4sy4nq> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" On Saturday, February 24, 2024 3:20:43 AM CET Ond=C5=99ej Jirman wrote: > On Thu, Feb 22, 2024 at 09:02:53PM +0100, Jernej =C5=A0krabec wrote: > > Dne sreda, 21. februar 2024 ob 14:45:20 CET je Maxime Ripard napisal(a): > > > Hi, > > >=20 > > > On Fri, Feb 16, 2024 at 08:04:26PM +0100, Ond=C5=99ej Jirman wrote: > > > > From: Ondrej Jirman > > > >=20 > > > > Identical configurations of planes can lead to different (and wrong) > > > > layer -> pipe routing at HW level, depending on the order of atomic > > > > plane changes. > > > >=20 > > > > For example: > > > >=20 > > > > - Layer 1 is configured to zpos 0 and thus uses pipe 0. No other la= yer > > > > is enabled. This is a typical situation at boot. > > > >=20 > > > > - When a compositor takes over and layer 3 is enabled, > > > > sun8i_ui_layer_enable() will get called with old_zpos=3D0 zpos=3D= 1, which > > > > will lead to incorrect disabling of pipe 0 and enabling of pipe 1. > > > >=20 > > > > What happens is that sun8i_ui_layer_enable() function may disable > > > > blender pipes even if it is no longer assigned to its layer. > > > >=20 > > > > To correct this, move the routing setup out of individual plane's > > > > atomic_update into crtc's atomic_update, where it can be calculated > > > > and updated all at once. > > > >=20 > > > > Remove the atomic_disable callback because it is no longer needed. > > > >=20 > > > > Signed-off-by: Ondrej Jirman > > >=20 > > > I don't have enough knowledge about the mixers code to comment on your > > > patch, so I'll let Jernej review it. However, this feels to me like t= he > > > pipe assignment is typically the sort of things that should be dealt > > > with device-wide, and in atomic_check. > >=20 > > In DE2 and DE3.0, you cannot move planes between mixers (crtcs), becaus= e each > > one is hardwired to specific mixer. Movable planes are the feature of D= E3.3 > > and one of the pain points for upstreaming the code. Anyway, this commi= t only > > addresses current issue of enabling and disabling planes and handling z= pos. > >=20 > > In atomic check you can only precalculate final register values, but I = don't > > see any benefit doing that. I think that this code elegantly solves cur= rent > > issue of enabling or disabling wrong plane in certain situations, so: > >=20 > > Reviewed-by: Jernej Skrabec > >=20 > > Note, if there is new revision, please rewrite blender regmap_update_bi= ts() > > to regmap_write(). Since there is HW issue with reads, I would like to > > get rid of regmap_update_bits() calls eventually. >=20 > I've looked into it and I can probably rewrite these quite readily: >=20 > + regmap_update_bits(mixer->engine.regs, > + SUN8I_MIXER_BLEND_ROUTE(bld_base), > + SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(0) | > + SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(1) | > + SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(2) | > + SUN8I_MIXER_BLEND_ROUTE_PIPE_MSK(3), > + route); >=20 > The mask here covers all implemented bits in the register. >=20 > + regmap_update_bits(mixer->engine.regs, > + SUN8I_MIXER_BLEND_PIPE_CTL(bld_base), > + SUN8I_MIXER_BLEND_PIPE_CTL_EN(0) | > + SUN8I_MIXER_BLEND_PIPE_CTL_EN(1) | > + SUN8I_MIXER_BLEND_PIPE_CTL_EN(2) | > + SUN8I_MIXER_BLEND_PIPE_CTL_EN(3), > + pipe_en); > + >=20 > The mask here doesn't cover BLD_FILL_COLOR_CTL.Px_FCEN bits that implemen= t solid > color filling. But those can be 0 anyway except for pipe0 which is hardco= ded by > the driver to 1, I think: >=20 > 631 /* > 632 * Set fill color of bottom plane to black. Generally not nee= ded > 633 * except when VI plane is at bottom (zpos =3D 0) and enabled. > 634 */ > 635 regmap_write(mixer->engine.regs, SUN8I_MIXER_BLEND_PIPE_CTL(b= ase), > 636 SUN8I_MIXER_BLEND_PIPE_CTL_FC_EN(0)); Correct on all counts. That's what I've meant. >=20 > I will not be able to get rid of regmap_update_bits in sun8i_layer_enable > because that register there has other important things in it like framebu= ffer > pixel format, etc. Yeah, this rework would certainly be more involved, so it's out of the scop= e of this series. Best regards, Jernej >=20 > kind regards, > o. >=20 > > Best regards, > > Jernej > >=20 > > >=20 > > > If I'm talking non-sense, it would be great to mention at least why t= hat > > > can't be an option in the commit log. > > >=20 > > > Maxime > > >=20 > >=20 > >=20 > >=20 > >=20 >=20