From patchwork Wed Aug 14 08:46:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13763101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B002BC531DC for ; Wed, 14 Aug 2024 08:47:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B0CA10E430; Wed, 14 Aug 2024 08:47:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="Nm/lcfyq"; dkim-atps=neutral Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by gabe.freedesktop.org (Postfix) with ESMTPS id 517A310E42F for ; Wed, 14 Aug 2024 08:47:03 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 0A4A5FF80D; Wed, 14 Aug 2024 08:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1723625222; 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=DQhoLS7i08diXkXbtDyfB57FaNUlq4prNXvWOdsu1Lw=; b=Nm/lcfyqa1O/kdujLGhvfB3KkPTBsUuCP4WFSLWcXT1W7MmO+EON5iZa3CgK96jKGO8oWB bEYbwdgU7ypLogin32tAcvcY4PxEdlxNraSt5BaBTCecTR/Is/gsSfDGtSIQier39k5xX3 yCr4dwOyQHkqDW18lTpyin7UZzU7hw41FW3aWLJlS22DvoTWLvD5EhmRai/7lP4MoDzY/b dEF8uvngATMoGfO2SefZZ+gAWX/mMluNVCarcAhTd97MFU1RkabUNp6FZHWzOHgB+Nbfy5 KKCG60JBPLoY0Z+KQ596H+d+oLiast9SzCDh5FYsiOULdnM69+DcsTEZUWEUFw== From: Louis Chauvet Date: Wed, 14 Aug 2024 10:46:58 +0200 Subject: [PATCH 1/3] drm/vkms: Formatting and typo fix MIME-Version: 1.0 Message-Id: <20240814-google-clarifications-v1-1-3ee76d7d0c28@bootlin.com> References: <20240814-google-clarifications-v1-0-3ee76d7d0c28@bootlin.com> In-Reply-To: <20240814-google-clarifications-v1-0-3ee76d7d0c28@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, 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.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1040; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=HkTR8P7eZOA/cD9/Ci7RUHkDKH0x6aG2NAlwkUXRY7M=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmvG8DQPc1IkCGVGW7pZSJQkZ/lPEjqCBBdruw1 auCE2m1bx6JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZrxvAwAKCRAgrS7GWxAs 4t0dEADPCsb5gb7MDZvQDbZITNlXTrm8Z7D+ShDXUsG3vBZnSiRfin9iM6XivfGFpPhz3Lpf13j r9NqzCFzqtAAn5YzJalLkcY4pv+nzwikQHMsXapYdnVirInZgQgCl1/zrJbxzcnTdj+9btVcjoH XvYKX8cCQCBOiYQEECYCxuP8ai9E4usoUdE0TwOJ1nJpKju5A1lSvhOvFYK0s5z3H/aS0EXSW5A PbCEzZfdgUnn4t9IjVBWt3nXEtJGaBfG1WAjVF9cF3wf2tSt+kpDk+RAMDWo1XIdtySvfj8iEjw YYh2Ovoi1GiCKU+qyv8aRBEUFCwHtsZHhg76g4heQCVBxWwh4Oyr6z++hq9gMcsPdL/CGbNeTjL K/0+0yl/RqKoHSbEqGj4sOr2rWitn0+mB0R0zUd7xkgtKv0eiCB32wZuX7fw1IamH/OYQwKbYhe re43JNLbnwKziGnmnL5hhCMS2HJAMAxKSoRfT5B1mE+pRlLXiktxNASYV1apW7QonXaUDwclMRS ll0/a5UvefhoxgveHJGTb7iOWwecQTRqv8dyswo2uZS+Cmj3LoN6ML94SwfRkZ4r8vwBfxD0O94 a4IiEwduJ4rw5MUzFwc39JR8btyf9sRsA/yp4KNlEJn913OhSMi8O8oD/+jfTjN6sWMEa5rexF4 9+F519cUB7Enf3g== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some newlines were missing around comments. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_drv.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 6860bee8e981..5aeb43592960 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -163,9 +163,11 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev) dev->mode_config.max_height = YRES_MAX; dev->mode_config.cursor_width = 512; dev->mode_config.cursor_height = 512; - /* FIXME: There's a confusion between bpp and depth between this and + /* + * FIXME: There's a confusion between bpp and depth between this and * fbdev helpers. We have to go with 0, meaning "pick the default", - * which ix XRGB8888 in all cases. */ + * which is XRGB8888 in all cases. + */ dev->mode_config.preferred_depth = 0; dev->mode_config.helper_private = &vkms_mode_config_helpers; From patchwork Wed Aug 14 08:46:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13763100 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A906DC52D7F for ; Wed, 14 Aug 2024 08:47:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1ACAA10E42F; Wed, 14 Aug 2024 08:47:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="p470ImzA"; dkim-atps=neutral Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3061510E42F for ; Wed, 14 Aug 2024 08:47:04 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 141CEFF803; Wed, 14 Aug 2024 08:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1723625223; 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=DCbZFQpDigD7WSa2TjFhEt/sfpOTKH+Lsi3n9wSaV8M=; b=p470ImzAw2ZhnIm3N+lAz66nYEIdqTab2rBMmEyxKZWNIdqD5E8lxPBlkTlBPDYvmeAnkj 6P8DEjX3gUg0iic7fmR0FB97ArgW0FPYpFuRmPnnc/IhBY41NClk22+k7PSpQUOAIkw/KE hYR8VjCOykSpY3DXS22ynTfcbsJDG2FuO34IAWjFBBDo4XGlN9I/Bg3mald5yosS9ZIzNg 3KPDsolTqgvpL69vzAUH7YPQMjVfqB46hITFa4BQ3ppupHU8GbVDZALG/Os2Mhw3Blmyl7 DHUb/dzaujM9t3aAhDm9xLxill4xc3Y1oaT6lXeQjAys6uZtigmzkRNzxc3fyQ== From: Louis Chauvet Date: Wed, 14 Aug 2024 10:46:59 +0200 Subject: [PATCH 2/3] drm/vkms: Rename index to possible_crtc MIME-Version: 1.0 Message-Id: <20240814-google-clarifications-v1-2-3ee76d7d0c28@bootlin.com> References: <20240814-google-clarifications-v1-0-3ee76d7d0c28@bootlin.com> In-Reply-To: <20240814-google-clarifications-v1-0-3ee76d7d0c28@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, 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.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3991; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=DlA2BwdMh4xiCAsPDy0jpunVjQO6N3fFDS0bdUg8TA8=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmvG8DzRFMIHt4BD+5tZFQRjnrYEKUllntFQx62 eKsZWaspsiJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZrxvAwAKCRAgrS7GWxAs 4r92D/94SEGxQxE2Xl0//T8uKzRU1+8Pt5CEqpINZ4xNCUyCbU0ffTB2rW3GRS30sg9bo4VRZGl 5gmWAHLTjHK2pnpc1v8hxd+ABdqefmw8kAXCgBbleS+DSD7Qc600eDfMUTelmk7/cSRdemBk1xA EtnzEN+Zk5zOQnGceGLpFAU/ARLMvkTykx/X7zq0GceQAwIGuXkxVRofmKZVVvLubKfr0PFpXqP doG/D7hvBVO0Gp9tw8zR+xZ3y0aV8AOcuUQvwZrw93emtFx5a7Rd+zxN5sIYhlkw8ud4Asr8hU5 iu0pSqHkW53WsFsG9NHyNn1Nd13D6F2whukysTze8zjPL1o7uoVa6FL+U2R6uVcub4eYeGIkQU6 A2gZSHkjRHF/baCV+PstlSPhsieEJXDNAEkqoYP/PmeN4gCNYIrxt47fFzlVo8pVF3nFwYAhSqL NwWQ0+T/Ui2d8zMmQO1W6Hhde/4sg2wCNNWaCz+lkPsTu3L8iroqhaUft6hxvXqynPArCatuZnD 6DzhmcHkAFa2EtfLEO0Dr3GGN/rwjLvGL2FZd+gBFx5nF0Ku/IEYq0yJCP3MLAOyqd5p8+Aetna ZHAgEDHRnEl8GaGWov4h489rQrWPKHRAh8XtJbnUByy32/pDC1AmCyHHJwXQdKN986O1zhzzXA8 lppjtFterqfgNcw== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The meaning of index was not clear. Replace them with crtc_index to clearly indicate its usage. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_drv.h | 4 ++-- drivers/gpu/drm/vkms/vkms_output.c | 13 +++++++------ drivers/gpu/drm/vkms/vkms_plane.c | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index 526bf5207524..3028678e4f9b 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -222,10 +222,10 @@ struct vkms_device { int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *primary, struct drm_plane *cursor); -int vkms_output_init(struct vkms_device *vkmsdev, int index); +int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index); struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, - enum drm_plane_type type, int index); + enum drm_plane_type type, int possible_crtc_index); /* CRC Support */ const char *const *vkms_get_crc_sources(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 5ce70dd946aa..d42ca7d10389 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -31,12 +31,12 @@ static const struct drm_connector_helper_funcs vkms_conn_helper_funcs = { .get_modes = vkms_conn_get_modes, }; -static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index, +static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int possible_crtc_index, struct drm_crtc *crtc) { struct vkms_plane *overlay; - overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index); + overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, possible_crtc_index); if (IS_ERR(overlay)) return PTR_ERR(overlay); @@ -46,7 +46,7 @@ static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index, return 0; } -int vkms_output_init(struct vkms_device *vkmsdev, int index) +int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) { struct vkms_output *output = &vkmsdev->output; struct drm_device *dev = &vkmsdev->drm; @@ -58,20 +58,21 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) int writeback; unsigned int n; - primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index); + primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index); + if (IS_ERR(primary)) return PTR_ERR(primary); if (vkmsdev->config->overlay) { for (n = 0; n < NUM_OVERLAY_PLANES; n++) { - ret = vkms_add_overlay_plane(vkmsdev, index, crtc); + ret = vkms_add_overlay_plane(vkmsdev, possible_crtc_index, crtc); if (ret) return ret; } } if (vkmsdev->config->cursor) { - cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, index); + cursor = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_CURSOR, possible_crtc_index); if (IS_ERR(cursor)) return PTR_ERR(cursor); } diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c index 03716616f819..9d85464ee0e9 100644 --- a/drivers/gpu/drm/vkms/vkms_plane.c +++ b/drivers/gpu/drm/vkms/vkms_plane.c @@ -219,12 +219,12 @@ static const struct drm_plane_helper_funcs vkms_plane_helper_funcs = { }; struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, - enum drm_plane_type type, int index) + enum drm_plane_type type, int possible_crtc_index) { struct drm_device *dev = &vkmsdev->drm; struct vkms_plane *plane; - plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << index, + plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << possible_crtc_index, &vkms_plane_funcs, vkms_formats, ARRAY_SIZE(vkms_formats), NULL, type, NULL); From patchwork Wed Aug 14 08:47:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 13763102 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53F12C52D7F for ; Wed, 14 Aug 2024 08:47:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D1B3D10E432; Wed, 14 Aug 2024 08:47:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=bootlin.com header.i=@bootlin.com header.b="B6quKT3F"; dkim-atps=neutral Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AFA310E42F for ; Wed, 14 Aug 2024 08:47:05 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 15457FF80E; Wed, 14 Aug 2024 08:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1723625224; 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=vUDiBZ7QGmfDJ6NaVojAOKA60EYcBMHsx6yhqDwupvU=; b=B6quKT3FTCNwzUzsjCKbtUV+kJt671euyp6xqClWODszCmB8X1M4Bywq9MIM6YARiAMa/r E4S/0d7PeKeP6NR5pKw6b7nupik1berGNvdYNP4P3Gc/+tbyl3wr0XuCB6j44iA8rngCl7 bhZMgu8XBxYjElF3/ZSQfVyVTIFNSaL29x0lfos+GdSCWkkDmineFia0qxQs1oiO6fWQI/ 1UWRsdXoJKYRpd18GlU0PeQyN5+nZnjVMtgHHjcwGK+MAwGA+b+tT4G8kN53muTnoAesiI PL5FhBbG4AzH/a+n5yMcCktOFevjFgCC+TTmEaaLJC1rFr/j7gyQrfjfd24t8Q== From: Louis Chauvet Date: Wed, 14 Aug 2024 10:47:00 +0200 Subject: [PATCH 3/3] drm/vkms: Add documentation MIME-Version: 1.0 Message-Id: <20240814-google-clarifications-v1-3-3ee76d7d0c28@bootlin.com> References: <20240814-google-clarifications-v1-0-3ee76d7d0c28@bootlin.com> In-Reply-To: <20240814-google-clarifications-v1-0-3ee76d7d0c28@bootlin.com> To: Rodrigo Siqueira , Melissa Wen , =?utf-8?q?Ma=C3=ADra_Canal?= , Haneen Mohammed , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie Cc: dri-devel@lists.freedesktop.org, arthurgrillo@riseup.net, 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.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=6986; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=aSuk2mWiTdVUJuBeR3o8G61bWGivtH+IEI1Je9+zlOk=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBmvG8D2bxpdTOBZKWkasIlq9cPBEXyLdvxEs7Xa Ro3ieEmMo+JAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZrxvAwAKCRAgrS7GWxAs 4kHaEADWsuy4j3Dw9nb0hNAkqxAC+ONbsQLL6x6nPJ1JwALS6ilapqlNqRTyvgRYIb4IyWMGSGH RxolxgsdFNIa78HGPqJbG3Lk7QF4i2ae9ViOi1kPDye5N/mNxPw8658mrjSkrMMw8mJUFMv3jx2 jziBG9dtzw3RAiiZ1bHutgl2KKHTe0H7VGDgnIgBDDS5gK2jDCV7HikBuZmZFSJ8e3h/dd3Qz3s hs6pOShZkIfpM5p6zQYNMtKy8TEKAQw93iwaS9vb+Oy+Y2j8iarGTWVcFxg7Adno6DAgn+mbEO2 BPTAdZObIgaldHa6zGKqFnfu8GdzVi2oGD5U2OObeXo2AO579ySKT5KcUQUjJ1sX6fjdORFaiVG UGPnnc6ZhonwW/76Mpd/nG8yAoAUCt9LDaP6FtngZ/2LeMSH/yGl5OuabXBQvPYD8KUC8fQ/wTN Pl7XLSqDhP06zuBIvLt4MsfOPElcYNyTOM9vpZ6izLGoOckj/FpQRQ7uMNmwHJr9OIpwecjFd/D XuCiNwVhWxJJ8nTftoHVW4mkkYMeV8A4lcYk4BHBsCFa58mT5uietJwZpQhw9vK7CAmax/xB7ru 6rQ43TkA7wLaQPIFJ7lTBSjrhUHAO250V9pYatMMKdhOJIB665AteIT6ag7I+WzdU6ceFwuFpW6 TyqajSxxK3UY03A== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add documentation around vkms_output and its initialization. Signed-off-by: Louis Chauvet --- drivers/gpu/drm/vkms/vkms_drv.h | 81 ++++++++++++++++++++++++++++++++------ drivers/gpu/drm/vkms/vkms_output.c | 12 +++++- 2 files changed, 80 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index 3028678e4f9b..8f6c9e67e671 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -147,29 +147,51 @@ struct vkms_color_lut { }; /** - * vkms_crtc_state - Driver specific CRTC state + * struct vkms_crtc_state - Driver specific CRTC state + * * @base: base CRTC state * @composer_work: work struct to compose and add CRC entries - * @n_frame_start: start frame number for computed CRC - * @n_frame_end: end frame number for computed CRC + * + * @num_active_planes: Number of active planes + * @active_planes: List containing all the active planes (counted by + * @num_active_planes). They should be stored in z-order. + * @active_writeback: Current active writeback job + * @gamma_lut: Look up table for gamma used in this CRTC + * @crc_pending: Protected by @vkms_output.composer_lock. + * @wb_pending: Protected by @vkms_output.composer_lock. + * @frame_start: Protected by @vkms_output.composer_lock. + * @frame_end: Protected by @vkms_output.composer_lock. */ struct vkms_crtc_state { struct drm_crtc_state base; struct work_struct composer_work; int num_active_planes; - /* stack of active planes for crc computation, should be in z order */ struct vkms_plane_state **active_planes; struct vkms_writeback_job *active_writeback; struct vkms_color_lut gamma_lut; - /* below four are protected by vkms_output.composer_lock */ bool crc_pending; bool wb_pending; u64 frame_start; u64 frame_end; }; +/** + * struct vkms_output - Internal representation of all output components in vkms + * + * @crtc: Base crtc in drm + * @encoder: DRM encoder used for this output + * @connector: DRM connector used for this output + * @wb_connecter: DRM writeback connector used for this output + * @vblank_hrtimer: + * @period_ns: + * @composer_workq: Ordered workqueue for composer_work + * @lock: Lock used to project concurrent acces to the composer + * @composer_enabled: Protected by @lock. + * @composer_state: + * @composer_lock: Lock used internally to protect @composer_state members + */ struct vkms_output { struct drm_crtc crtc; struct drm_encoder encoder; @@ -177,28 +199,38 @@ struct vkms_output { struct drm_writeback_connector wb_connector; struct hrtimer vblank_hrtimer; ktime_t period_ns; - /* ordered wq for composer_work */ struct workqueue_struct *composer_workq; - /* protects concurrent access to composer */ spinlock_t lock; - /* protected by @lock */ bool composer_enabled; struct vkms_crtc_state *composer_state; spinlock_t composer_lock; }; -struct vkms_device; - +/** + * struct vkms_config - General configuration for VKMS driver + * + * @writeback: If true, a writeback buffer can be attached to the CRTC + * @cursor: If true, a cursor plane is created in the VKMS device + * @overlay: If true, NUM_OVERLAY_PLANES will be created for the VKMS device + * @dev: Used to store the current vkms device. Only set when the device is instancied. + */ struct vkms_config { bool writeback; bool cursor; bool overlay; - /* only set when instantiated */ struct vkms_device *dev; }; +/** + * struct vkms_device - Description of a vkms device + * + * @drm - Base device in drm + * @platform - Associated platform device + * @output - Configuration and sub-components of the vkms device + * @config: Configuration used in this vkms device + */ struct vkms_device { struct drm_device drm; struct platform_device *platform; @@ -206,6 +238,10 @@ struct vkms_device { const struct vkms_config *config; }; +/* + * The following helpers are used to convert a member of a struct into its parent. + */ + #define drm_crtc_to_vkms_output(target) \ container_of(target, struct vkms_output, crtc) @@ -218,12 +254,33 @@ struct vkms_device { #define to_vkms_plane_state(target)\ container_of(target, struct vkms_plane_state, base.base) -/* CRTC */ +/** + * vkms_crtc_init() - Initialize a crtc for vkms + * @dev: drm_device associated with the vkms buffer + * @crtc: uninitialized crtc device + * @primary: primary plane to attach to the crtc + * @cursor plane to attach to the crtc + */ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *primary, struct drm_plane *cursor); +/** + * vkms_output_init() - Initialize all sub-components needed for a vkms device. + * + * @vkmsdev: vkms device to initialize + * @possible_crtc_index: Crtc which can be attached to the planes. The caller must ensure that + * possible_crtc_index is positive and less or equals to 31. + */ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index); +/** + * vkms_plane_init() - Initialize a plane + * + * @vkmsdev: vkms device containing the plane + * @type: type of plane to initialize + * @possible_crtc_index: Crtc which can be attached to the plane. The caller must ensure that + * possible_crtc_index is positive and less or equals to 31. + */ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, enum drm_plane_type type, int possible_crtc_index); diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index d42ca7d10389..36db2c8923cb 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -21,6 +21,7 @@ static int vkms_conn_get_modes(struct drm_connector *connector) { int count; + /* Use the default modes list from drm */ count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX); drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF); @@ -58,8 +59,13 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) int writeback; unsigned int n; + /* + * Initialize used plane. One primary plane is required to perform the composition. + * + * The overlay and cursor planes are not mandatory, but can be used to perform complex + * composition. + */ primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, possible_crtc_index); - if (IS_ERR(primary)) return PTR_ERR(primary); @@ -96,6 +102,10 @@ int vkms_output_init(struct vkms_device *vkmsdev, int possible_crtc_index) DRM_ERROR("Failed to init encoder\n"); goto err_encoder; } + /* + * This is an hardcoded value to select crtc for the encoder. + * 1 here designate the first registered CRTC, the one allocated in [1] + */ encoder->possible_crtcs = 1; ret = drm_connector_attach_encoder(connector, encoder);