Received: by 2002:ab2:78c:0:b0:1ec:b906:25e5 with SMTP id h12csp256277lqe; Fri, 23 Feb 2024 03:38:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0zrp8Inx/FhVX8/kfaJf8gj/Dy+FQs9ANuo+j3b0K+R1l9mCl77A7dBsWZox/tW2yGfHc9d0G5N9At8ibVTTmzUcYuk/Xij5vClJ99w== X-Google-Smtp-Source: AGHT+IHB43uhkK3XLYReLSO3OONlKSUd3Wn92E8SPaOo6a/BFKHOvvgl+pv/WoCt3rcr9IpEJ5hJ X-Received: by 2002:a17:902:da8c:b0:1db:d826:45a1 with SMTP id j12-20020a170902da8c00b001dbd82645a1mr8087001plx.9.1708688310947; Fri, 23 Feb 2024 03:38:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708688310; cv=pass; d=google.com; s=arc-20160816; b=DdvLqiGKjsHtE/tjU9aG0FaHrKP3FB0trVB79h+pf+nvKnf+AbcB/BDQPcZJGrfqrT nrq10nDCC3lQ4cTb1f+M/6DVg7a51RoKas4CasE6yRRCXM1L8gqc3z4bCKdaR5c05hDe Fj1MrwFzpd2VigIi/scEfKh3IfjnJPYiDKXv4wTW1T9IOFYNBL8d06n2L+6K93h8/5U6 oPZ2qGDYkoAdRNdjyr45XXbl/dcvSAlIXE2NBMjc1pJj3XsrUM7G1rK+xSqVHMc+TLTM 0UDroi4QpZwELCf2jNaatJb1dtdOYg7k1YcsdsB4/yJOOEFuUDpDQMJ78V58Qwk1fuEM kpZg== 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=Ifnpa8zr1id8PgJXAuNZq9AhudHBZLq2Kwr93pnBEgE=; fh=iHhInxAKO971yxjXRXHdZ2xJcC9kj/+DtynTqxKEQCo=; b=jL5dEIpA6fRFn3GYF752w+NiLHipXw7GiF4AVRYRtdVjMC0H4dELcNG4CBuNGL+cLY 1XnRUKXJIpnG95/Qs1bMhIq+8gXudm2KtYR/IO4If3uEmZp/SWr8HD4l+HvKYTS8BK+z ISd3jf3o7RD8mEvmElHArCJdN66K+38okXf+0uIbWcdVq6xiAPkQmIcZdMhJPgeFyLR7 TN7+H8CDwoDgTHCJaLYsMXoM+v3VemVcVe9NcAYqG3UGIJlmchoTpz7l9uXrngQ8aQo2 AqzHRUbrC176/PeGrD9tYnZ00EWJUPyZIaRlaZi53PJyBVofbdcJVOQXXN0UFcYoyelq Gy5g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=b0zmyfS+; 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-78233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o9-20020a170902d4c900b001d9859103e0si12076641plg.153.2024.02.23.03.38.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 03:38:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=b0zmyfS+; 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-78233-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78233-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 9B47128240C for ; Fri, 23 Feb 2024 11:38:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC8B07C08D; Fri, 23 Feb 2024 11:37:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="b0zmyfS+" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (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 D28BB7B3FA for ; Fri, 23 Feb 2024 11:37:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708688268; cv=none; b=gvioCDwPDKDGNhKcOqkfwFK1eVqQfvHIZdS0vRMSflFNFmB5aibj42S4m/hHzEh3Jwk2FSdWZAhDODJxGCJELNPS0tyU2/emSa1hLkIFxl3lwQR7ZbKEeoXnaaZfhObAfglKfzBRgy12Y0Hg1WsqB3RmFl8U9K2IPxH3fIYUmMg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708688268; c=relaxed/simple; bh=mBNtO9MRdQyVSUnp0677/U3/dj0DCJQz7n5ZIh29cQE=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=rJuWL3ERHy5SSSHZz6s9RAR95AXheGx34DV3vGO50aiY3PRcWj512jDPEbSxAjTr2tXZds3RKqK150wo5N55j9fFBR4G5HaiDsyhCD/Tilb7384hAmh2ghIB0Duj0MaetbythDs2wzkp06b7lIOC3HMxni7QEUx16AQdZBfTWVI= 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=b0zmyfS+; arc=none smtp.client-ip=217.70.183.194 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 3795C40003; Fri, 23 Feb 2024 11:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708688263; 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=Ifnpa8zr1id8PgJXAuNZq9AhudHBZLq2Kwr93pnBEgE=; b=b0zmyfS+9hX6zpg2BoKv+GQp29BajjAmhNNNuroNVnLpyMFMEYTCefpuKRxKkdNmuFSTPv fUeS2BCL1dqlcFQB1IsHDBR/YzlefjC+0nBqKWcWfPVyh3t04MvktSiSBDpANOI52SzSlS 2Qc2alkYhbg0cICKX8HddioLKALFf+Vr1lSPVIPMhATWwjjVYfAYzcAi1ql9Nhl26izR6d SFdd4EgVE80RNz6U0IoP4oCvWV+/qHwP8X5xfYjRAYg40asQIRZrvVTjDjVp9Ep51YOXkX g5wOpIADJxJDyQ3KK9CNOuFQk976cCsHqRG9j7kN7QwXDv/OwXzXkPezoZAUPQ== From: Louis Chauvet Subject: [PATCH v2 0/9] drm/vkms: Reimplement line-per-line pixel conversion for plane reading Date: Fri, 23 Feb 2024 12:37:20 +0100 Message-Id: <20240223-yuv-v2-0-aa6be2827bb7@bootlin.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="utf-8" Content-Transfer-Encoding: 8bit X-B4-Tracking: v=1; b=H4sIAHCD2GUC/1WNyw6CMBBFf4XM2po+lAZX/odhUUqxk9TWtNBIC P/uyM7lObk5d4PiMroCt2aD7CoWTJFAnhqw3sSnYzgSg+TywiUXbF0qE0rpseNjd9Ut0HIwxbE hm2g9beMSAsl3dhN+jvSjJ/ZY5pTX46mKn/2PVsE4U9Yo3U5St0reh5TmgPFs0wv6fd+/D8E/B K0AAAA= 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 Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, jeremie.dautheribes@bootlin.com, miquel.raynal@bootlin.com, thomas.petazzoni@bootlin.com, Louis Chauvet X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6323; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=mBNtO9MRdQyVSUnp0677/U3/dj0DCJQz7n5ZIh29cQE=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl2IN+GTYEFNEAcoL/p6sJ5vjm9X3v40h/neLWa2yK Wgf0TvOJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZdiDfgAKCRAgrS7GWxAs4rdMD/ 9Ngf3zJRcQPu9bD2hXq1E9sgmcV85hIia99c6PSm9wHwO9HHgCf7hwN01UST03oJgT/MglWYrZndXX zl9c0SrSrlMFznOO9E+xjNI67Kqku94u7CPun6c0UmhBk7qQYOe6x+rnABs507vUpfmIae6YD1k4g+ hkJHKKlDYMr/PmGPpbhtQziizHrjyfaXaCGgl8zu60iJ9pjMBKKd91VDs0gtTOcq5Jtg+h9oxtRC91 23K8sHXtVb5a03mD7h2oU7ZXVpCfUGpm+EV7ay/k0p1b28kFcWEi3YEEKz4NX132HvoD5XF7a/zAC/ sUB1vxKM2P5Z2u0z8T4fx2MUDC7KeTvUL7if7Uvev4vqHudT1kiyRaV7bw0STMvsGzRX/fP+K0V0WG RsEKkLtk5BoGlv1GXj1YVMmATbQ2G7KkHZyw5Qi2O/4Lnz2G1/frgcW6h726YI4/FWwVCnrru7BXVQ +4XEFmdPQpdH19fMAyukAyvKPFL2AjGvZeaGBuZZyd8Mmy2WeTConPyX15+rP/MPT0Wxb+LK1Fwh1p EcbSNrEWSOpXB2XgNu3aml2/ZQ5PECimbtWrLys5q3vsqYF+x7YanUprayOryMjFr8arMLLZDypxlA EjGnU7ugmn4TPHOeOGlBaq17DWN2O3+eT6Abb2RXcf2uQ2qCKY+6bxB2G0zw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com 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: main patch for this series, it reintroduce the line-by-line algorithm - PATCH 6 to 9: taken from Arthur's series [2], with sometimes adaptation to use the pixel-by-pixel algorithm. The PATCH 5 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. If I did something wrong here, please let me know. 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 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 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 v2: - Rebased the series on top of drm-misc/drm-misc-net - Extract the typedef for pixel_read/pixel_write - Introduce the line-by-line algorithm per pixel format - Add some documentation for existing and new code - Port the series [1] to use line-by-line algorithm - Link to v1: https://lore.kernel.org/r/20240201-yuv-v1-0-3ca376f27632@bootlin.com --- Arthur Grillo (5): drm/vkms: Use drm_frame directly drm/vkms: Add YUV support drm/vkms: Add range and encoding properties to pixel_read function drm/vkms: Drop YUV formats TODO drm/vkms: Create KUnit tests for YUV conversions Louis Chauvet (4): drm/vkms: Code formatting drm/vkms: write/update the documentation for pixel conversion and pixel write functions drm/vkms: Add typedef and documentation for pixel_read and pixel_write functions drm/vkms: Re-introduce line-per-line composition algorithm Documentation/gpu/vkms.rst | 3 +- drivers/gpu/drm/vkms/Makefile | 1 + drivers/gpu/drm/vkms/tests/.kunitconfig | 4 + drivers/gpu/drm/vkms/tests/Makefile | 3 + drivers/gpu/drm/vkms/tests/vkms_format_test.c | 155 +++++++ drivers/gpu/drm/vkms/vkms_composer.c | 233 ++++++++--- drivers/gpu/drm/vkms/vkms_crtc.c | 6 +- drivers/gpu/drm/vkms/vkms_drv.c | 3 +- drivers/gpu/drm/vkms/vkms_drv.h | 56 ++- drivers/gpu/drm/vkms/vkms_formats.c | 565 +++++++++++++++++++++----- drivers/gpu/drm/vkms/vkms_formats.h | 13 +- drivers/gpu/drm/vkms/vkms_plane.c | 50 ++- drivers/gpu/drm/vkms/vkms_writeback.c | 14 +- 13 files changed, 916 insertions(+), 190 deletions(-) --- base-commit: aa1267e673fe5307cf00d02add4017d2878598b6 change-id: 20240201-yuv-1337d90d9576 Best regards, -- Louis Chauvet