Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1876959lqe; Tue, 9 Apr 2024 03:11:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUOoIWKrHNWTbbcowRhn0+bln4zIycp1D8d5G8PF3yEcS9eXW3Sc8XMlux6PmLhpVa6+N3MPG1DTXk5w7C0lxK/Qzc9KTTS+7viH1IB4w== X-Google-Smtp-Source: AGHT+IGZwFxIqIeMPvK1+AELVMLJyiCK7EeqzTdCxnFxcInUnO9Id802ntrCt8IoeHLCF6js7WF+ X-Received: by 2002:a05:6a00:9399:b0:6ed:5f64:2ffa with SMTP id ka25-20020a056a00939900b006ed5f642ffamr4903697pfb.0.1712657497959; Tue, 09 Apr 2024 03:11:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712657497; cv=pass; d=google.com; s=arc-20160816; b=h4PQF4R6pDBbNvdoGtc6QuXeB7U8hJtCfRbf6Max4zmpibNH1uTVynz912xKZ2ctTy rNxmzBiRi4EDnpmLevAGM9oe0jAUsxxY70GKpm1XDvm4SCwSJf74hbmaiT/SWslQZinf SC1CS1/6IbtyJM3Fx0vecHjTXqiAprYctWS4juL+RNaBQAT2fxj/qBsVtAlbVRpZi+C5 b3KtH54pY6q6Pmhxt5uU485HOS6aYTRjEkAaoUPIbC9K+PMdVJPqzm75ZMD6ds+HtfBK LHfkIRCIUF/ckBRAprmaIQuvw4/xFGgP0M2zwYFdOXrtKdrsW+dDfXZzAzWEOLWvX7Zk XPaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=sqqIhw8jAz1IoeoUfDX7ZgfwWio/XO2e8ETDGPutQoo=; fh=45eQo3ZJsZ9kxlKtiBlNFdEPxIxcGnXy8eMk/mnf88Q=; b=kUSztOoakOR3tSfof5zCV9TdjHW6IpkiFWy9rlCDxKH8tAFAAAAluvIanGU8FSfQvM S1dNtl3nKgObyyFkQu8p5X7Xmf5N8Fsn8IgGXZoDZqRilBKQMelFIog9fWM31QA4Tkca VzhmLJ0WUHqQUGoLEhnOTwVEtt7apIezjSHDHdNkpWa75z7QPHMUlIebm1QfpZxWZZXg fG2ORNXkqtlYvLSC7PBOCF5NtMa5sbISZuLe3uJkixUyg1JL1egY7EIBqckjkHV1OU51 UnjUrdpU7ypq5mZrULW6QfqZHnYn1Jlyry9ziVP9F1g64fiXZ2psn5ehm7F+hZA/XLhC eyjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EhDDzU8s; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-136629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136629-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id hq4-20020a056a00680400b006e71c651cbdsi8202425pfb.69.2024.04.09.03.11.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 03:11:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EhDDzU8s; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-136629-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136629-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4A849B2345C for ; Tue, 9 Apr 2024 10:07:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49BAF7D3E8; Tue, 9 Apr 2024 10:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EhDDzU8s" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDD4680629 for ; Tue, 9 Apr 2024 10:06:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712657173; cv=none; b=i4m7xDcr0WHjrgKxDz91wkvqVoqJX8S4gK497dBjdgjEaoI9sUPeN6JS6y6Nl3OGn2n0Vd4Z/IlVqLbmUJHW6rYG4murKquBLzP9dABaJLy2ARKxgPYzjMxHuygkxu2CTPFQFU599dne3QEJNnLimFyYYrXNcAAZqdQUfgs+V1s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712657173; c=relaxed/simple; bh=mFNJ9GJFypFrzBVHys9OFUZJBSzxvUUASZWHXI5sgdE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uwX7GQKbnhaNDFp8VuNai3MDb9ND/y3VMe09KkeWlrKLioCqVt2QXY+Z2HVoRR3NQdE9xhGs9xhwkBEfDfaKJvvfn9gYQGzFhJCuk25D4Ad9b3urzHUBwEpTh6+o0j7Bz3rmh9OOGnD+9mYKBq/B675SAEFJqfz4+irx6QQJkkQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=EhDDzU8s; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 7D6AD1BF20A; Tue, 9 Apr 2024 10:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712657169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sqqIhw8jAz1IoeoUfDX7ZgfwWio/XO2e8ETDGPutQoo=; b=EhDDzU8sbXO2ORX1BNpoLu25UrKjUEPzb9gNNo8miMT0FPupYk7lY0bAQanUccet26IqAA psBd8WSI0zQ52F3Vpp8D0z7YBSorfAiM9JP9EPexHpKShEAdMEQETjIjreZN1sIFTYZt7t 7/ltiVNI+C4klRoDpshneoU+hPBcRI+GEKJsCE8k3K2qFsgUgOUaVpHYK445VMHIjFZFXa qZ6FXEavoyigREs61NNE951CB7nxmJDWUI4mZOMUvi6UrTX/OKwdtAVSNS2iEz0tluLtrY OsMOJjfJKtrHobVLsCn3qLAX2a+tkexP7azuvYP8r6dkw+uE3x9SN389tCJI7A== Date: Tue, 9 Apr 2024 12:06:06 +0200 From: Louis Chauvet To: Pekka Paalanen Cc: Rodrigo Siqueira , Melissa Wen , =?iso-8859-1?Q?Ma=EDra?= Canal , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , arthurgrillo@riseup.net, Jonathan Corbet , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com Subject: Re: [PATCH v5 09/16] drm/vkms: Introduce pixel_read_direction enum Message-ID: Mail-Followup-To: Pekka Paalanen , Rodrigo Siqueira , Melissa Wen , =?iso-8859-1?Q?Ma=EDra?= Canal , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , arthurgrillo@riseup.net, Jonathan Corbet , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, seanpaul@google.com, marcheu@google.com, nicolejadeyee@google.com References: <20240313-yuv-v5-0-e610cbd03f52@bootlin.com> <20240313-yuv-v5-9-e610cbd03f52@bootlin.com> <20240325151103.0a5f7112.pekka.paalanen@collabora.com> <20240327141629.48ec16f2.pekka.paalanen@collabora.com> <20240409103537.44e99854.pekka.paalanen@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240409103537.44e99854.pekka.paalanen@collabora.com> X-GND-Sasl: louis.chauvet@bootlin.com Le 09/04/24 - 10:35, Pekka Paalanen a ?crit : > On Mon, 8 Apr 2024 09:50:18 +0200 > Louis Chauvet wrote: > > > Le 27/03/24 - 14:16, Pekka Paalanen a ?crit : > > > On Tue, 26 Mar 2024 16:57:00 +0100 > > > Louis Chauvet wrote: > > > > > > > Le 25/03/24 - 15:11, Pekka Paalanen a ?crit : > > > > > On Wed, 13 Mar 2024 18:45:03 +0100 > > > > > Louis Chauvet wrote: > > > > > > > > > > > The pixel_read_direction enum is useful to describe the reading direction > > > > > > in a plane. It avoids using the rotation property of DRM, which not > > > > > > practical to know the direction of reading. > > > > > > This patch also introduce two helpers, one to compute the > > > > > > pixel_read_direction from the DRM rotation property, and one to compute > > > > > > the step, in byte, between two successive pixel in a specific direction. > > > > > > > > > > > > Signed-off-by: Louis Chauvet > > > > > > --- > > > > > > drivers/gpu/drm/vkms/vkms_composer.c | 36 ++++++++++++++++++++++++++++++++++++ > > > > > > drivers/gpu/drm/vkms/vkms_drv.h | 11 +++++++++++ > > > > > > drivers/gpu/drm/vkms/vkms_formats.c | 30 ++++++++++++++++++++++++++++++ > > > > > > 3 files changed, 77 insertions(+) > > > > > > > > > > > > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c > > > > > > index 9254086f23ff..989bcf59f375 100644 > > > > > > --- a/drivers/gpu/drm/vkms/vkms_composer.c > > > > > > +++ b/drivers/gpu/drm/vkms/vkms_composer.c > > > > > > I hope IGT uses FB patterns instead of solid color in its tests of > > > > > rotation to be able to detect the difference. > > > > > > > > They use solid colors, and even my new rotation test [3] use solid colors. > > > > > > That will completely fail to detect rotation and reflection bugs then. > > > E.g. userspace asks for 180-degree rotation, and the driver does not > > > rotate at all. Or rotate-180 getting confused with one reflection. > > > > I think I missunderstood what you means with "solid colors". > > > > The tests uses a plane with multiple solid colors: > > > > +-------+-------+ > > | White | Red | > > +-------+-------+ > > | Blue | Green | > > +-------+-------+ > > > > But it don't use gradients because of YUV. > > > > Oh, that works. No worries then. > > > > > It is mainly for yuv formats with subsampling: if you have formats with > > > > subsampling, a "software rotated buffer" and a "hardware rotated buffer" > > > > will not apply the same subsampling, so the colors will be slightly > > > > different. > > > > > > Why would they not use the same subsampling? > > > > YUV422, for each pair of pixels along a horizontal line, the U and V > > components are shared between those two pixels. However, along a vertical > > line, each pixel has its own U and V components. > > > > When you rotate an image by 90 degrees: > > - Hardware Rotation: If you use hardware rotation, the YUV subsampling > > axis will align with what was previously the "White-Red" axis. The > > hardware will handle the rotation. > > - Software Rotation: If you use software rotation, the YUV subsampling > > axis will align with what was previously the "Red-Green" axis. > > That would be a bug in the software rotation. Yes, but it is very complex to fix I think, so I did not chose this path :) > > Because the subsampling compression axis changes depending on whether > > you're using hardware or software rotation, the compression effect on > > colors will differ. Specifically: > > - Hardware rotation, a gradient along the "White-Red" axis may be > > compressed (i.e same UV component for multiple pixels along the > > gradient). > > - Software rotation, the same gradient will not be compressed (i.e, each > > different color in the gradient have dedicated UV component) > > > > The same reasoning also apply for "color borders", and my series [3] avoid > > this issue by choosing the right number of pixels. > > What is [3]? I don't know why I put [3] here, I probably mixed references between mails [3]: https://lore.kernel.org/all/20240313-new_rotation-v2-0-6230fd5cae59@bootlin.com/ > I've used similar tactics in the Weston test suite, when I have no > implementation for chroma siting: the input and reference images > consist of 2x2 equal color pixel groups, so that chroma siting makes no > difference. When chroma siting will be implemented, the tests will be > extended. > > Is there a TODO item to fix the software rotation bug and make the > tests more sensitive? > > I think documenting this would be an ok intermediate solution. > > > > The framebuffer contents are defined in its natural orientation, and > > > the subsampling applies in the natural orientation. If such a FB > > > is on a rotated plane, one must account for subsampling first, and > > > rotate second. 90-degree rotation does not change the encoded color. > > > > > > Getting the subsampling exactly right is going to be necessary sooner > > > or later. There is no UAPI for setting chroma siting yet, but ideally > > > there should be. > > > > > > > > The return values do seem correct to me, assuming I have guessed > > > > > correctly what "X" and "Y" refer to when combined with rotation. I did > > > > > not find good documentation about that. > > > > > > > > Yes, it is difficult to understand how rotation and reflexion should > > > > works in drm. I spend half a day testing all the combination in drm_rect_* > > > > helpers to understand how this works. According to the code: > > > > - If only rotation or only reflexion, easy as expected > > > > - If reflexion and rotation are mixed, the source buffer is first > > > > reflected and then rotated. > > > > > > Now that you know, you could send a documentation patch. :-) > > > > And now I'm not sure about it :) > > You'll have people review the patch and confirm your understanding or > point out a mistake. A doc patch it easier to notice and jump in than > this series. I just send it [4], you are in copy. [4]: https://lore.kernel.org/all/20240409-google-drm-doc-v1-0-033d55cc8250@bootlin.com/ > > I was running the tests on my v6, and for the first time ran my new > > rotation [3] on the previous VKMS code. None of the tests for > > ROT_90+reflexion and ROT_270+reflexion are passing... > > > > So, either the previous vkms implementation was wrong, or mine is wrong :) > > > > So, if a DRM expert can explain this, it could be nice. > > > > To have a common example, if I take the same buffer as above > > (white+red+blue+green), if I create a plane with rotation = > > ROTATION_90 | REFLECTION_X, what is the expected result? > > > > 1 - rotation then reflection > > > > +-------+-------+ > > | Green | Red | > > +-------+-------+ > > | Blue | White | > > +-------+-------+ > > > > 2 - reflection then rotation (my vkms implementation) > > > > +-------+-------+ > > | White | Blue | > > +-------+-------+ > > | Red | Green | > > +-------+-------+ > > > > I wish I knew. :-) > > Thanks, > pq > > > > > For me as a userspace developer, the important place is > > > https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#standard-plane-properties > > >