From patchwork Mon May 8 07:53:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 13234182 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 F025AC77B73 for ; Mon, 8 May 2023 07:54:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C7A2510E106; Mon, 8 May 2023 07:54:04 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by gabe.freedesktop.org (Postfix) with ESMTPS id BCE8E10E139 for ; Mon, 8 May 2023 07:54:02 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2a02:2f05:8115:9300:9eb6:d0ff:fe91:8037]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mvlad) by madras.collabora.co.uk (Postfix) with ESMTPSA id 88F116603264; Mon, 8 May 2023 08:54:00 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683532441; bh=huhcWtt1gb2DzP82kA9cyR5kjiCXe3xm8As34p5mgwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fPXDZ6r5srW6wXDUxGg4JIp2ex3Qpa1tFyNab4V4gpYkTz/w6zS9d7UiHVbHnr/xQ 6VMm1uLfJutf5lNNHv+e2zESaaPfqkYoK481pFEMd+82jHF59fsHWA7a96bDlcF+Aj +lRbrQROvkZhzm6vEkRcCn7AMIPQndswCKkFTgOltnnbmdF3CgoQcsrNfl0NQEtMPE JFQ3UHCBamztDEYj2W014u9EPzMsZsMCwPV7UYvRcebC5dxbX5sqtGffSXGwWGVpBc 1lwkNAExRDVaWVPevYafMOLuQLb/8S0ZUz98DMVdr8TR51Qy7lVyNTrRCLeuMKpvXK uU5K7ZfU60Z1w== From: Marius Vlad To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 1/4] vkms: Pass the correct bitmask for possible crtcs Date: Mon, 8 May 2023 10:53:53 +0300 Message-Id: <20230508075356.6511-2-marius.vlad@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230508075356.6511-1-marius.vlad@collabora.com> References: <20230508075356.6511-1-marius.vlad@collabora.com> MIME-Version: 1.0 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: , Cc: mwen@igalia.com, tzimmermann@suse.de, rodrigosiqueiramelo@gmail.com, yixie@chromium.org, mcanal@igalia.com, melissa.srw@gmail.com, jshargo@chromium.org, brpol@chromium.org, marius.vlad@collabora.com, igormtorrente@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In preparation of having multiple pipelines we need to able to choose the correct encoder/connectors/crtc combination so pass also the index as a bitmask as possible CRTCs for the encoder. Signed-off-by: Marius Vlad --- drivers/gpu/drm/vkms/vkms_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 5ce70dd946aa..1b8aa3a34e46 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -95,7 +95,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) DRM_ERROR("Failed to init encoder\n"); goto err_encoder; } - encoder->possible_crtcs = 1; + encoder->possible_crtcs = (1 << index); ret = drm_connector_attach_encoder(connector, encoder); if (ret) { From patchwork Mon May 8 07:53:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 13234186 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 04C6FC7EE24 for ; Mon, 8 May 2023 07:54:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B21CE10E146; Mon, 8 May 2023 07:54:12 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3632110E13D for ; Mon, 8 May 2023 07:54:05 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2a02:2f05:8115:9300:9eb6:d0ff:fe91:8037]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mvlad) by madras.collabora.co.uk (Postfix) with ESMTPSA id 9BD426603283; Mon, 8 May 2023 08:54:01 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683532442; bh=+i2StJwB35cFnm3Egu+L97HEqYnYP0qSnw4b9yTX6fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QMI8VfaoGAl01Am/pxknIOEO64J2EWijnrDVOYs9a+7KFYYgUpkKqCfGztSbnoUgp OAJ8pEoMibNdOGWEsTJ2fgZNx2mFpL0es3jGROnQ3YfJzUW3LGIXpRiQPehGeu4YgN lTpdJXPZMgK1WiIj4YY258H5ddsh4yYPnzLbha5XjKdbAlnC/8Hf1IzFyB8Npuxbzq rdjCSBxucCC7TuCjig6T1oRMefuCxO5woHAXf2tdSh0QjPcrCFvlRAV659zEUoAeic 0OpXJuSNRvn8HWnf+lFQ4+HDzvYYcsigZWCfQY2YcL+tSf/luXUBMn+EOxbaw/yRI7 HUe1g7FuR5RMA== From: Marius Vlad To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 2/4] drm/vkms: Add overlay_planes config Date: Mon, 8 May 2023 10:53:54 +0300 Message-Id: <20230508075356.6511-3-marius.vlad@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230508075356.6511-1-marius.vlad@collabora.com> References: <20230508075356.6511-1-marius.vlad@collabora.com> MIME-Version: 1.0 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: , Cc: mwen@igalia.com, tzimmermann@suse.de, rodrigosiqueiramelo@gmail.com, yixie@chromium.org, mcanal@igalia.com, melissa.srw@gmail.com, jshargo@chromium.org, brpol@chromium.org, marius.vlad@collabora.com, igormtorrente@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" And init it by default to NUM_OVERLAY_PLANES. This change would allow us to configure the amount of overlay planes we can have in combination with multiple pipes, in case we'll exceed the number of planes we can have. Signed-off-by: Marius Vlad --- drivers/gpu/drm/vkms/vkms_drv.c | 2 ++ drivers/gpu/drm/vkms/vkms_drv.h | 1 + drivers/gpu/drm/vkms/vkms_output.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index e3c9c9571c8d..bd53194f1525 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -99,6 +99,7 @@ static int vkms_config_show(struct seq_file *m, void *data) seq_printf(m, "writeback=%d\n", vkmsdev->config->writeback); seq_printf(m, "cursor=%d\n", vkmsdev->config->cursor); seq_printf(m, "overlay=%d\n", vkmsdev->config->overlay); + seq_printf(m, "overlay_planes=%d\n", vkmsdev->config->overlay_planes); return 0; } @@ -230,6 +231,7 @@ static int __init vkms_init(void) config->cursor = enable_cursor; config->writeback = enable_writeback; config->overlay = enable_overlay; + config->overlay_planes = NUM_OVERLAY_PLANES; ret = vkms_create(config); if (ret) diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index f152d54baf76..ae2b38360236 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -112,6 +112,7 @@ struct vkms_config { bool writeback; bool cursor; bool overlay; + unsigned int overlay_planes; /* only set when instantiated */ struct vkms_device *dev; }; diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 1b8aa3a34e46..f4e67a0ad712 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -63,7 +63,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) return PTR_ERR(primary); if (vkmsdev->config->overlay) { - for (n = 0; n < NUM_OVERLAY_PLANES; n++) { + for (n = 0; n < vkmsdev->config->overlay_planes; n++) { ret = vkms_add_overlay_plane(vkmsdev, index, crtc); if (ret) return ret; From patchwork Mon May 8 07:53:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 13234184 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 0C3B8C77B75 for ; Mon, 8 May 2023 07:54:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3ED6510E13D; Mon, 8 May 2023 07:54:08 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by gabe.freedesktop.org (Postfix) with ESMTPS id 368FA10E140 for ; Mon, 8 May 2023 07:54:05 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2a02:2f05:8115:9300:9eb6:d0ff:fe91:8037]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mvlad) by madras.collabora.co.uk (Postfix) with ESMTPSA id C504A66032CF; Mon, 8 May 2023 08:54:02 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683532443; bh=Wxi3WqANE0H+bo570N/ao83/PfzK/tOf4L7taHWEfcM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G1+ZcViMR5qOBFO27fKZGpc9VuvMg7fDQFgHKQoQbqx4vz21/TvZU7h5twDe9D+3b iOAiXdtwEEqDL2sG5B7z3BsjMYyEfk/yF2yv/m5DYekwP3z0nJzBQG7jPE5sXel+8z xEq1mklapi/FaOqUbG/gAAo4hDVSSQ7EWw6AvqdOPGCJMErF60QVbJtOeDiE46aD3g WOv8Y9w70TxLrPN5Tg0jr9Kg9MQbi7V6r992JIl8KR2CI387wIVA1U0+vaBH/NYNMh XvE0CUgSPzTiTbZ0FvNCAvFpz/otBUZNIFmRj++f4SnQzhd8ZEYblC+3vhTlABrWbQ RHxaBi9hOcUcg== From: Marius Vlad To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 3/4] vkms: Add support for multiple pipes Date: Mon, 8 May 2023 10:53:55 +0300 Message-Id: <20230508075356.6511-4-marius.vlad@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230508075356.6511-1-marius.vlad@collabora.com> References: <20230508075356.6511-1-marius.vlad@collabora.com> MIME-Version: 1.0 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: , Cc: mwen@igalia.com, tzimmermann@suse.de, rodrigosiqueiramelo@gmail.com, yixie@chromium.org, mcanal@igalia.com, melissa.srw@gmail.com, jshargo@chromium.org, brpol@chromium.org, marius.vlad@collabora.com, igormtorrente@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This adds support for creating multiple virtual pipes, in case one would need to display multiple independent things on different outputs. We use a module parameter to specify how many to create, defaulting to just one with the possibility of specifying a maximum of 4 possible pipes. This is of particular importance when testing out the DRM back-end in compositors, but also to be able to independently set different DPMS states. Signed-off-by: Marius Vlad --- drivers/gpu/drm/vkms/vkms_crtc.c | 3 +-- drivers/gpu/drm/vkms/vkms_drv.c | 37 ++++++++++++++++++++++----- drivers/gpu/drm/vkms/vkms_drv.h | 12 ++++++--- drivers/gpu/drm/vkms/vkms_output.c | 5 ++-- drivers/gpu/drm/vkms/vkms_writeback.c | 24 ++++++++--------- 5 files changed, 55 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c index 515f6772b866..051e7b647db9 100644 --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c @@ -89,8 +89,7 @@ static bool vkms_get_vblank_timestamp(struct drm_crtc *crtc, { struct drm_device *dev = crtc->dev; unsigned int pipe = crtc->index; - struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev); - struct vkms_output *output = &vkmsdev->output; + struct vkms_output *output = drm_crtc_to_vkms_output(crtc); struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; if (!READ_ONCE(vblank->enabled)) { diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index bd53194f1525..b93157fa5336 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -51,14 +51,19 @@ static bool enable_overlay; module_param_named(enable_overlay, enable_overlay, bool, 0444); MODULE_PARM_DESC(enable_overlay, "Enable/Disable overlay support"); +static unsigned int max_pipes = 1; +module_param_named(max_pipes, max_pipes, int, 0444); +MODULE_PARM_DESC(max_pipes, "Specify how many pipes to create"); + DEFINE_DRM_GEM_FOPS(vkms_driver_fops); static void vkms_release(struct drm_device *dev) { - struct vkms_device *vkms = drm_device_to_vkms_device(dev); + int i; + struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev); - if (vkms->output.composer_workq) - destroy_workqueue(vkms->output.composer_workq); + for (i = 0; i < vkmsdev->config->max_pipes; i++) + destroy_workqueue(vkmsdev->output[i].composer_workq); } static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state) @@ -100,6 +105,7 @@ static int vkms_config_show(struct seq_file *m, void *data) seq_printf(m, "cursor=%d\n", vkmsdev->config->cursor); seq_printf(m, "overlay=%d\n", vkmsdev->config->overlay); seq_printf(m, "overlay_planes=%d\n", vkmsdev->config->overlay_planes); + seq_printf(m, "pipes=%d\n", vkmsdev->config->max_pipes); return 0; } @@ -134,7 +140,7 @@ static const struct drm_mode_config_helper_funcs vkms_mode_config_helpers = { static int vkms_modeset_init(struct vkms_device *vkmsdev) { struct drm_device *dev = &vkmsdev->drm; - int ret; + int ret, i; ret = drmm_mode_config_init(dev); if (ret) @@ -153,7 +159,14 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev) dev->mode_config.preferred_depth = 0; dev->mode_config.helper_private = &vkms_mode_config_helpers; - return vkms_output_init(vkmsdev, 0); + for (i = 0; i < vkmsdev->config->max_pipes; i++) { + ret = vkms_output_init(vkmsdev, i); + if (ret) + return ret; + } + + drm_mode_config_reset(dev); + return ret; } static int vkms_create(struct vkms_config *config) @@ -189,7 +202,7 @@ static int vkms_create(struct vkms_config *config) goto out_devres; } - ret = drm_vblank_init(&vkms_device->drm, 1); + ret = drm_vblank_init(&vkms_device->drm, config->max_pipes); if (ret) { DRM_ERROR("Failed to vblank\n"); goto out_devres; @@ -232,7 +245,19 @@ static int __init vkms_init(void) config->writeback = enable_writeback; config->overlay = enable_overlay; config->overlay_planes = NUM_OVERLAY_PLANES; + config->max_pipes = max_pipes; + + if (config->max_pipes > NUM_MAX_PIPES) + config->max_pipes = NUM_MAX_PIPES; + if (config->max_pipes < NUM_MIN_PIPES) + config->max_pipes = NUM_MIN_PIPES; + + /* with NUM_OVERLAY_PLANES overlays and 4 pipes we'll exceed the amount + * of planes we can have; see drm_mode_config::num_total_plane */ + if (config->overlay && config->max_pipes == NUM_MAX_PIPES) + config->overlay_planes -= 2; + DRM_INFO("Initialized with %u pipes\n", config->max_pipes); ret = vkms_create(config); if (ret) kfree(config); diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index ae2b38360236..29617cd491e3 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -21,7 +21,9 @@ #define XRES_MAX 8192 #define YRES_MAX 8192 -#define NUM_OVERLAY_PLANES 8 +#define NUM_OVERLAY_PLANES 8 +#define NUM_MAX_PIPES 4 +#define NUM_MIN_PIPES 1 struct vkms_frame_info { struct drm_framebuffer *fb; @@ -113,6 +115,7 @@ struct vkms_config { bool cursor; bool overlay; unsigned int overlay_planes; + unsigned int max_pipes; /* only set when instantiated */ struct vkms_device *dev; }; @@ -120,13 +123,16 @@ struct vkms_config { struct vkms_device { struct drm_device drm; struct platform_device *platform; - struct vkms_output output; + struct vkms_output output[NUM_MAX_PIPES]; const struct vkms_config *config; }; #define drm_crtc_to_vkms_output(target) \ container_of(target, struct vkms_output, crtc) +#define wb_connector_to_vkms_output(target) \ + container_of(target, struct vkms_output, wb_connector) + #define drm_device_to_vkms_device(target) \ container_of(target, struct vkms_device, drm) @@ -158,6 +164,6 @@ void vkms_set_composer(struct vkms_output *out, bool enabled); void vkms_compose_row(struct line_buffer *stage_buffer, struct vkms_plane_state *plane, int y); /* Writeback */ -int vkms_enable_writeback_connector(struct vkms_device *vkmsdev); +int vkms_enable_writeback_connector(struct vkms_device *vkmsdev, int index); #endif /* _VKMS_DRV_H_ */ diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index f4e67a0ad712..ca4dc16b8d01 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -48,7 +48,7 @@ static int vkms_add_overlay_plane(struct vkms_device *vkmsdev, int index, int vkms_output_init(struct vkms_device *vkmsdev, int index) { - struct vkms_output *output = &vkmsdev->output; + struct vkms_output *output = &vkmsdev->output[index]; struct drm_device *dev = &vkmsdev->drm; struct drm_connector *connector = &output->connector; struct drm_encoder *encoder = &output->encoder; @@ -104,12 +104,11 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) } if (vkmsdev->config->writeback) { - writeback = vkms_enable_writeback_connector(vkmsdev); + writeback = vkms_enable_writeback_connector(vkmsdev, index); if (writeback) DRM_ERROR("Failed to init writeback connector\n"); } - drm_mode_config_reset(dev); return 0; diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c index 84a51cd281b9..5f291689f870 100644 --- a/drivers/gpu/drm/vkms/vkms_writeback.c +++ b/drivers/gpu/drm/vkms/vkms_writeback.c @@ -101,7 +101,7 @@ static void vkms_wb_cleanup_job(struct drm_writeback_connector *connector, struct drm_writeback_job *job) { struct vkms_writeback_job *vkmsjob = job->priv; - struct vkms_device *vkmsdev; + struct vkms_output *output = wb_connector_to_vkms_output(connector); if (!job->fb) return; @@ -110,19 +110,18 @@ static void vkms_wb_cleanup_job(struct drm_writeback_connector *connector, drm_framebuffer_put(vkmsjob->wb_frame_info.fb); - vkmsdev = drm_device_to_vkms_device(job->fb->dev); - vkms_set_composer(&vkmsdev->output, false); + vkms_set_composer(output, false); kfree(vkmsjob); } static void vkms_wb_atomic_commit(struct drm_connector *conn, struct drm_atomic_state *state) { - struct drm_connector_state *connector_state = drm_atomic_get_new_connector_state(state, - conn); - struct vkms_device *vkmsdev = drm_device_to_vkms_device(conn->dev); - struct vkms_output *output = &vkmsdev->output; - struct drm_writeback_connector *wb_conn = &output->wb_connector; + struct drm_connector_state *connector_state = + drm_atomic_get_new_connector_state(state, conn); + struct drm_writeback_job *wb_job = connector_state->writeback_job; + struct drm_writeback_connector *wb_conn = wb_job->connector; + struct vkms_output *output = wb_connector_to_vkms_output(wb_conn); struct drm_connector_state *conn_state = wb_conn->base.state; struct vkms_crtc_state *crtc_state = output->composer_state; struct drm_framebuffer *fb = connector_state->writeback_job->fb; @@ -135,7 +134,7 @@ static void vkms_wb_atomic_commit(struct drm_connector *conn, if (!conn_state) return; - vkms_set_composer(&vkmsdev->output, true); + vkms_set_composer(output, true); active_wb = conn_state->writeback_job->priv; wb_frame_info = &active_wb->wb_frame_info; @@ -147,6 +146,7 @@ static void vkms_wb_atomic_commit(struct drm_connector *conn, wb_frame_info->cpp = fb->format->cpp[0]; crtc_state->wb_pending = true; spin_unlock_irq(&output->composer_lock); + drm_writeback_queue_job(wb_conn, connector_state); active_wb->wb_write = get_line_to_frame_function(wb_format); drm_rect_init(&wb_frame_info->src, 0, 0, crtc_width, crtc_height); @@ -160,9 +160,9 @@ static const struct drm_connector_helper_funcs vkms_wb_conn_helper_funcs = { .atomic_commit = vkms_wb_atomic_commit, }; -int vkms_enable_writeback_connector(struct vkms_device *vkmsdev) +int vkms_enable_writeback_connector(struct vkms_device *vkmsdev, int index) { - struct drm_writeback_connector *wb = &vkmsdev->output.wb_connector; + struct drm_writeback_connector *wb = &vkmsdev->output[index].wb_connector; drm_connector_helper_add(&wb->base, &vkms_wb_conn_helper_funcs); @@ -171,5 +171,5 @@ int vkms_enable_writeback_connector(struct vkms_device *vkmsdev) &vkms_wb_encoder_helper_funcs, vkms_wb_formats, ARRAY_SIZE(vkms_wb_formats), - 1); + 1 << index); } From patchwork Mon May 8 07:53:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 13234185 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 DC41AC77B73 for ; Mon, 8 May 2023 07:54:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90A0F10E140; Mon, 8 May 2023 07:54:08 +0000 (UTC) Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0114410E146 for ; Mon, 8 May 2023 07:54:05 +0000 (UTC) Received: from localhost.localdomain (unknown [IPv6:2a02:2f05:8115:9300:9eb6:d0ff:fe91:8037]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mvlad) by madras.collabora.co.uk (Postfix) with ESMTPSA id D90216603292; Mon, 8 May 2023 08:54:03 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683532444; bh=7VsQdU5bz+yiUSRD3GWJUoPKbVsu2uauG6KZQB8tu8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QrISE5IENE7ylIP9p0ykIdTDJQ2Z5AywYfskXsmsgeWg86pb7AI8ZSuGiUM2XcoI0 fpV/9ZnXm0NmbY2O1mvDjASeYLNi1ypiegbFl6RvtfkEuT9MkNQySVLrrZWTzHQJ7z DGcfX/c2ULETiKXQYtrYDDyLqwRUeHyMCWyCRHMPAFfeGBC7vf3uNevIJsimX1TJRK KK0A51jGAA4eUiCaHN01KA7ma/zrdCXsA+C0TYZQpdyOwaTjmBSO2FpcUAkLkA8oep 7L2zE4XGXB1ht0inhTSDGSp4srflsnyf5Bdq8UUPrMJQIcj/cl0IRwhw7yYXMqDYf2 2vLw/UaKvltdw== From: Marius Vlad To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 4/4] Documentation/gpu/vkms.rst: Added a note about plane migration Date: Mon, 8 May 2023 10:53:56 +0300 Message-Id: <20230508075356.6511-5-marius.vlad@collabora.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230508075356.6511-1-marius.vlad@collabora.com> References: <20230508075356.6511-1-marius.vlad@collabora.com> MIME-Version: 1.0 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: , Cc: mwen@igalia.com, tzimmermann@suse.de, rodrigosiqueiramelo@gmail.com, yixie@chromium.org, mcanal@igalia.com, melissa.srw@gmail.com, jshargo@chromium.org, brpol@chromium.org, marius.vlad@collabora.com, igormtorrente@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" And remove the run-time configuration comment regarding needing first more than 1 pipe. Signed-off-by: Marius Vlad --- Documentation/gpu/vkms.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/gpu/vkms.rst b/Documentation/gpu/vkms.rst index 0f599c897614..5b5b20409e57 100644 --- a/Documentation/gpu/vkms.rst +++ b/Documentation/gpu/vkms.rst @@ -128,6 +128,8 @@ There's lots of plane features we could add support for: - Async updates (currently only possible on cursor plane using the legacy cursor api). +- Overlay plane migration between CRTCs + For all of these, we also want to review the igt test coverage and make sure all relevant igt testcases work on vkms. They are good options for internship project. @@ -141,8 +143,7 @@ module. Use/Test-cases: - Hotplug/hotremove connectors on the fly (to be able to test DP MST handling of compositors). -- Configure planes/crtcs/connectors (we'd need some code to have more than 1 of - them first). +- Configure planes/crtcs/connectors - Change output configuration: Plug/unplug screens, change EDID, allow changing the refresh rate.