From patchwork Mon Mar 4 15:28:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 21301 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6299:b0:17c:1df7:5ed3 with SMTP id se25csp281429rwb; Mon, 4 Mar 2024 08:00:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVKI8TKDCefH7lv4ustLiGg1CXS5dvG1IVG8Ea7WTLzs4hMQxco952gktL6a7wf2EeQPnrVtIPRU+HTEd7WpbD9V1LYUw== X-Google-Smtp-Source: AGHT+IGlqV0CMud77DvPOylvwx7gKr71ncyBUHnKiibSeKedujtDt8L7sZyxNwLJXd8aHfZCRLZJ X-Received: by 2002:a05:6a21:a598:b0:1a1:4da9:c507 with SMTP id gd24-20020a056a21a59800b001a14da9c507mr3143361pzc.5.1709568017128; Mon, 04 Mar 2024 08:00:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709568017; cv=pass; d=google.com; s=arc-20160816; b=V9cmSwgE+5kt8fICsjfIMpcthWesPz0KEUbUIzsG0ohxBZI5H8Zj7oNmzcBBcfHFHN j0Rp+rnzgTyYED2FzFRIrPZrezch70dBxecwydthX38+WEziuuQ4fddJIj3HB/lMX4Wf GPI8f/2CKRL8U6wVc+1Ky47PafmRbtAkygUBT6C/afZhYaJDmtd4iBokn37j/rD5yCy4 hdeWtpo9GCU8kc/OTr+wmUrYAv7yTbHH45rsjcenaIENALa3P0b/zD69tHqdi02EPLpg OaX2LC9HtZPpBGsn7NX8z47FO0s98tk59r2pwpDmfIa8svhyZrDg93TIolDtq5jocQuM 6JWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:from :dkim-signature; bh=p4VyPuPWctRMKsSKKnHnhgfKmx3KohaktZO2hx+9UzE=; fh=I1mDzpQ2i/fckVIeMd+WKWb14s85mMQWc3/wF4wbFPI=; b=LEeUi+Wtr2RIKymvckmn57rPaHKEEyUr4ZbADgr6v/qcdqN3NNXMlCsfFkNy0j6yAW S4VtqY3R5gVW3djDjRmhwV94vxkWtddBOg+94ijx4qpd5Y9cfjDbIjXhwy5Y0X4rYapH gnI5DkN63YP5DvoJJGawMLG28MVtTw5Oci5lp3UiccgzvtUO4s6Ty8HJfZPZGdm5tfhk YMgjgZ0XvIs0I1UGEf0ceNh8vlhpQsciH/qXeMiAEJRPyTr0+OFh98eqoFQAZl8g53n8 hJnZbxZJkiMkMjcuvOus0v5IhcIcJnZvgf+9qOp9NbQmuFYSlurLpdZGqc+Fnv/TopTp JCBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EtIEczIv; 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-90820-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90820-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k184-20020a6324c1000000b005dc87643cd1si8630244pgk.138.2024.03.04.08.00.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:00:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90820-ouuuleilei=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=EtIEczIv; 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-90820-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90820-ouuuleilei=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 0CF37B26007 for ; Mon, 4 Mar 2024 15:30:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91A914D599; Mon, 4 Mar 2024 15:29:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EtIEczIv" Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 A9903487BE for ; Mon, 4 Mar 2024 15:29:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566164; cv=none; b=cXLxjFEbIxmRCWtS//uWZhjx5kSQkBCpn1xOrvGtvJHZuZ8ZQSIAPpgIxXQVLAHGW4NGSiBwo5+WmhRclJi9rAkUK7GJ1Z3o6yeAyQmQP5UAe3MmguCpA1fxzgHOSyU2MBI03g9qxqhljokP62STwvKqKfi2vEOCj72Up1s8U/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566164; c=relaxed/simple; bh=vconTWJf3hkrQzDYTc60aASNd6jpDkr3/nMsFeCdX/M=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=Ouk49f3FOxeOYjD5TKLlp0ErW+u1+c5DuYOx1QR91f44QxWrqHMI8xrhZ4t5WcnnZe4gue5YC2aKFbunCrMA8YlXkHDB71r3rkHCkSh8dLEBmNvY8hPA8XM3xP8KvMTtPOS2vmwF1b5p4ffEtNH9MzDfW+/aDCsgIUpd1OjdGEM= 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=EtIEczIv; arc=none smtp.client-ip=217.70.183.197 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 9D3021C0005; Mon, 4 Mar 2024 15:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709566159; 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; bh=p4VyPuPWctRMKsSKKnHnhgfKmx3KohaktZO2hx+9UzE=; b=EtIEczIvozkpeBA10mLGWbF3Mk0mc6A95rd4ktHrEYfHCtyJ5F71a4Mb/71vIQa6kYYZuQ w9LgsvhriTyj8KGZ1NDCTZjDylVQ5e7etcqxvSVo/Yyq/tADXkI8f/T/G47012vyBTUwnb B9SLAQdtPEvfHaZugC/WpIJndSulgj0vPpsyJLAFDH3Uu3mIK7n93tKaNP245gdDKVblXh C/F4H02hQAvhR7L2cvcz7NcnLQfKfHQV7KrbTTtrANkejLmuxmWpfDabqHeoU9o77CfATc E+juXtwsyKsfsWDXRzHcyxE6IIQBqZzHfcIpRNJwmcRRBLACKxcuZ6MpvCf7GA== From: Louis Chauvet Subject: [PATCH v4 00/14] drm/vkms: Reimplement line-per-line pixel conversion for plane reading Date: Mon, 04 Mar 2024 16:28:05 +0100 Message-Id: <20240304-yuv-v4-0-76beac8e9793@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAIbo5WUC/2XNQQ6DIBAF0KsY1qXBwULtqvdougCESmKhASU1x rsXdaPp8v/M+zOhqIPVEd2KCQWdbLTe5VCdCqRa4V4a2yZnBAQqAqTE45BwSSlvatLUF85QvpQ iaiyDcKrNt27oulx+gjb2u04/njm3NvY+jOunVC7tcTSVmGCqBOXMAGcU7tL7vrPurPwbLQsJd gropiArIZjUcAUuJf9XdK/YpmhWxjAGhtR11cijmuf5Bw20BCUZAQAA To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , arthurgrillo@riseup.net, Jonathan Corbet , pekka.paalanen@haloniitty.fi Cc: 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, Louis Chauvet X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=8415; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=vconTWJf3hkrQzDYTc60aASNd6jpDkr3/nMsFeCdX/M=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl5ejKSkW5zpF9YuBBe/BTUGRlKz3pzdJMCieHG1pT hiv0gkKJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZeXoygAKCRAgrS7GWxAs4hj3D/ 9eACMyg9HBiq7pJAfprAQKwbSZdVmwH3KxJN8FeOnLOugfSMaxU4axep1gBRvt2F6JfJU3GxaiNfO+ phLqUZ355uZgflAH1X5C17AiR3owGznf9VeRZJ3bZXkZrLVxD4rm54wNGL160Uf62GasmMMImkR4KA FGthmc6mswWtuq3OGN+7kPAErGWXbBnwhDqiGoW/xEB11ivCxJpcO+PaDZ1HB7no0Wsdtd37S2UUDP Dik0LL+iyGSEhMBvFDHNYWXllh6+g6NlMBmGZHh5OHTe/+dKPIK9O8ZpMqkfcrgISPdzPuyX1Z5Rkz UkeCf0NDRqmFF242EV/cWATJpJ1ubSRfEvu+wgVbAzITpkVC55+Mm6hIIjZPrwCqs50wt3hfesv6N6 KxtiScAm1hWy/eZmQaNG3tXHlcj2G8k5Wfbomutyt0LVN+P7aaJKKFcFErg6442zvAbh6nHfOhDpHx 0PixxZev/+AU9iL8RZ5J4RIOxcrNFQwWlSNfongODLpqeCr6Ufp20t6iRMjD0DYEd2sqxyUtaVZdGr s0XDPQIphA4vnlQboYJtuXSHGG9BTzjLa7QOJsgubU4eQgcHfuvSczno0kMn7IG6+zlzDamnN95jFc 6wT0/jIJV16Bs8QQQhHtsnc3y/D8G13GErS9kWlYU5Hk+SKimqnp3y5CoiMA== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792611993391526075 X-GMAIL-MSGID: 1792611993391526075 This patchset is the second version of [1]. It is almost a complete rewrite to use a line-by-line algorithm for the composition. It can be divided in three parts: - PATCH 1 to 4: no functional change is intended, only some formatting and documenting (PATCH 2 is taken from [2]) - PATCH 5 to 8: Some preparation work not directly related to the line-by-line algorithm - PATCH 9: main patch for this series, it reintroduce the line-by-line algorithm - PATCH 10 to 13: taken from Arthur's series [2], with sometimes adaptation to use the pixel-by-pixel algorithm. The PATCH 9 aims to restore the line-by-line pixel reading algorithm. It was introduced in 8ba1648567e2 ("drm: vkms: Refactor the plane composer to accept new formats") but removed in 8ba1648567e2 ("drm: vkms: Refactor the plane composer to accept new formats") in a over-simplification effort. At this time, nobody noticed the performance impact of this commit. After the first iteration of my series, poeple notice performance impact, and it was the case. Pekka suggested to reimplement the line-by-line algorithm. Expiriments on my side shown great improvement for the line-by-line algorithm, and the performances are the same as the original line-by-line algorithm. I targeted my effort to make the code working for all the rotations and translations. The usage of helpers from drm_rect_* avoid reimplementing existing logic. The only "complex" part remaining is the clipping of the coordinate to avoid reading/writing outside of src/dst. Thus I added a lot of comments to help when someone will want to add some features (framebuffer resizing for example). The YUV part is not mandatory for this series, but as my first effort was to help the integration of YUV, I decided to rebase Arthur's series on mine to help. I took [3], [4], [5] and [6] and adapted them to use the line-by-line reading. They were also updated to use 32.32 fixed point values for yuv conversion instead of 8.8 fixed points. My series was mainly tested with: - kms_plane (for color conversions) - kms_rotation_crc (for rotations of planes) - kms_cursor_crc (for translations) The benchmark used to measure the improvment was done with: - kms_fb_stress [1]: https://lore.kernel.org/r/20240201-yuv-v1-0-3ca376f27632@bootlin.com [2]: https://lore.kernel.org/all/20240110-vkms-yuv-v2-0-952fcaa5a193@riseup.net/ [3]: https://lore.kernel.org/all/20240110-vkms-yuv-v2-3-952fcaa5a193@riseup.net/ [4]: https://lore.kernel.org/all/20240110-vkms-yuv-v2-5-952fcaa5a193@riseup.net/ [5]: https://lore.kernel.org/all/20240110-vkms-yuv-v2-6-952fcaa5a193@riseup.net/ [6]: https://lore.kernel.org/all/20240110-vkms-yuv-v2-7-952fcaa5a193@riseup.net/ To: Rodrigo Siqueira To: Melissa Wen To: MaĆ­ra Canal To: Haneen Mohammed To: Daniel Vetter To: Maarten Lankhorst To: Maxime Ripard To: Thomas Zimmermann To: David Airlie To: arthurgrillo@riseup.net To: Jonathan Corbet To: pekka.paalanen@haloniitty.fi Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Cc: jeremie.dautheribes@bootlin.com Cc: miquel.raynal@bootlin.com Cc: thomas.petazzoni@bootlin.com Cc: seanpaul@google.com Cc: marcheu@google.com Cc: nicolejadeyee@google.com Signed-off-by: Louis Chauvet Note: after my changes, those tests seems to pass, so [7] may need updating (I did not check, it was maybe already the case): - kms_cursor_legacy@flip-vs-cursor-atomic - kms_pipe_crc_basic@nonblocking-crc - kms_pipe_crc_basic@nonblocking-crc-frame-sequence - kms_writeback@writeback-pixel-formats - kms_writeback@writeback-invalid-parameters - kms_flip@flip-vs-absolute-wf_vblank-interruptible And those tests pass, I did not investigate why the runners fails: - kms_flip@flip-vs-expired-vblank-interruptible - kms_flip@flip-vs-expired-vblank - kms_flip@plain-flip-fb-recreate - kms_flip@plain-flip-fb-recreate-interruptible - kms_flip@plain-flip-ts-check-interruptible - kms_cursor_legacy@cursorA-vs-flipA-toggle - kms_pipe_crc_basic@nonblocking-crc - kms_prop_blob@invalid-get-prop - kms_flip@flip-vs-absolute-wf_vblank-interruptible - kms_invalid_mode@zero-hdisplay - kms_invalid_mode@bad-vtotal - kms_cursor_crc.* (everything is SUCCEED or SKIP, but no fails) [7]: https://lore.kernel.org/all/20240201065346.801038-1-vignesh.raman@collabora.com/ Changes in v4: - PATCH 3/14: Update comments for get_pixel_* functions - PATCH 4/14: Add WARN when trying to get unsupported pixel_* functions - PATCH 5/14: Create dummy pixel reader/writer to avoid NULL function pointers and kernel OOPS - PATCH 6/14: Added the usage of const pointers when needed - PATCH 7/14: Extraction of pixel accessors modification - PATCH 8/14: Extraction of the blending function modification - PATCH 9/14: Extraction of the pixel_read_direction enum - PATCH 10/14: Update direction_for_rotation documentation - PATCH 10/14: Rename conversion functions to be explicit - PATCH 10/14: Replace while(count) by while(out_pixel