From patchwork Mon Dec 13 18:11:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12674495 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 4DD89C433F5 for ; Mon, 13 Dec 2021 18:11:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2564C10E833; Mon, 13 Dec 2021 18:11:44 +0000 (UTC) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 54C3310E829 for ; Mon, 13 Dec 2021 18:11:41 +0000 (UTC) Received: by mail-wm1-x32b.google.com with SMTP id j140-20020a1c2392000000b003399ae48f58so14633487wmj.5 for ; Mon, 13 Dec 2021 10:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iBIfrfnr3GLdb1qUMNUHlNu3PuJL3644gLoGb9X9DGQ=; b=ebJJ52GfshhjdOeOLj4xc0X1TjsexXLbPjpxlTZN3+kZq9w+ZRup8HjxhqlWI9kC5j 6YvHc4n6xZzUVApWRKW0taYd/OB9Oa4JzHqffwc7y2bNqiwHo3/83leRNDFIC0uBTut9 MTnUunzTRDjzexMXRiLwrHqNpAmxEBH1T8hn/aPXASlVP8+DUNCV9nfYT6H55rYXtGje VT/sIfrowy4gW8GEfTpObCVssF0tGXeo0uVaEM5aKyd+o2vcmcgHB+Mmz2AV0a/4rl4s KfCwkBbZZrIPT0d9g8bvRDb1fNM4uGUz/N8Luwc5oVwuAVKPHvrciYNhh+IU0RB6SZk/ T8Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iBIfrfnr3GLdb1qUMNUHlNu3PuJL3644gLoGb9X9DGQ=; b=2twIaPZ9Vcc9BClTpTCCG1ZXrUCPm+hbJeWd6a+6ftLkbJf8Fwq50sah+Fjgf9LR/9 w49IUxTaLSC5aV37lbdENsCdfn2S9TPzdeJurfkMZzDYeW4M7uFL0fUUe1C2/dTtSEBH bZl73SX7wuAnDN7eOvOQt9Brdyws2bVxz1SpmJ6xPdz5RbHlSGFwk89RJkYo7gf2fwBx URdLcQMrHWbJvGd74RHNqMomPUL8XG4Hlgl40/zoJlnrOaC4d+BV4yivWwvaGmK+hNEL S+W+Kuwzh6Nh+Jv3LAOxCCjKC6VYQEdvVDjaFOdPdvyN5S3RcXME2tetrYDi5ZDpXzJd xj8Q== X-Gm-Message-State: AOAM530Pc9OO58NNL2NDZL8c1XZmfKNs+iibiHQ37Q03vSUsqUQ4uTZX uXfztqWVEUBmw7LBDFQ6axQ= X-Google-Smtp-Source: ABdhPJyfQFFdMLlstFu4ZT190nQFT3inzt1bjDzISqxrWE4zsWyirInch5YIHXakodSbJe0Ataqppg== X-Received: by 2002:a1c:f005:: with SMTP id a5mr41519157wmb.19.1639419099777; Mon, 13 Dec 2021 10:11:39 -0800 (PST) Received: from localhost.localdomain ([217.113.240.86]) by smtp.gmail.com with ESMTPSA id t127sm8750956wma.9.2021.12.13.10.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 10:11:39 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: rodrigosiqueiramelo@gmail.com Subject: [PATCH 1/3] drm/vkms: refactor overlay plane creation Date: Mon, 13 Dec 2021 19:11:29 +0100 Message-Id: <20211213181131.17223-2-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211213181131.17223-1-jose.exposito89@gmail.com> References: <20211213181131.17223-1-jose.exposito89@gmail.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: hamohammed.sa@gmail.com, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, melissa.srw@gmail.com, =?utf-8?b?Sm9zw6kg?= =?utf-8?b?RXhww7NzaXRv?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Move the logic to create an overlay plane to its own function. Refactor, no functional changes. Signed-off-by: José Expósito --- drivers/gpu/drm/vkms/vkms_output.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c index 04406bd3ff02..2e805b2d36ae 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -32,6 +32,21 @@ 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, + struct drm_crtc *crtc) +{ + struct vkms_plane *overlay; + + overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index); + if (IS_ERR(overlay)) + return PTR_ERR(overlay); + + if (!overlay->base.possible_crtcs) + overlay->base.possible_crtcs = drm_crtc_mask(crtc); + + return 0; +} + int vkms_output_init(struct vkms_device *vkmsdev, int index) { struct vkms_output *output = &vkmsdev->output; @@ -39,7 +54,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) struct drm_connector *connector = &output->connector; struct drm_encoder *encoder = &output->encoder; struct drm_crtc *crtc = &output->crtc; - struct vkms_plane *primary, *cursor = NULL, *overlay = NULL; + struct vkms_plane *primary, *cursor = NULL; int ret; int writeback; @@ -48,12 +63,9 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) return PTR_ERR(primary); if (vkmsdev->config->overlay) { - overlay = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_OVERLAY, index); - if (IS_ERR(overlay)) - return PTR_ERR(overlay); - - if (!overlay->base.possible_crtcs) - overlay->base.possible_crtcs = drm_crtc_mask(crtc); + ret = vkms_add_overlay_plane(vkmsdev, index, crtc); + if (ret) + return ret; } if (vkmsdev->config->cursor) { From patchwork Mon Dec 13 18:11:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12674493 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 BF363C433FE for ; Mon, 13 Dec 2021 18:11:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F50610E82E; Mon, 13 Dec 2021 18:11:43 +0000 (UTC) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C6DB10E833 for ; Mon, 13 Dec 2021 18:11:42 +0000 (UTC) Received: by mail-wm1-x335.google.com with SMTP id p18so12565500wmq.5 for ; Mon, 13 Dec 2021 10:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L26QAQQcTwvk9g4RJGDyk1KPZJQ2+Mcn67zF6WZ46Tk=; b=nwMF68xQhLMQiy7BGFuGPjIv1QBzKA/WhAhJ5WVxTQi/YF71dqNQ93w/BLlNfP/5/w 6He4QIGp5qN95RSQoEqSqTbKIHcKp+4xnxs9wtYlEOuCgfUJp8D8trc1vKNJhTFC7/eC hROi9dKHCth6SXl8/Dlzufy+j4DoWYxdyw3FfiD/23O+7ogooJK4h+vy6dSvNCIZegM9 BYES8GOewV+blDJxwRfIl8qw8gCop8ECuJ81EJv1PuOVXr5A3G8pvS/sRoOt9ZEdWTcM VCEZqjTX6yAFSSPZIzd1YaTXUGYaXwp/PNgDC3uuLcJZ3iX4XT+oBWsdTekYUWRg7V1Y IFrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L26QAQQcTwvk9g4RJGDyk1KPZJQ2+Mcn67zF6WZ46Tk=; b=78CJFw3ZXKWIwI69+K8c17UIQyYYrVNyjgErmxOj53LNytpivgVdhKZSckr5H40Mo8 3QKxuL+NISQ6LX3b65Llecz//u5ktomtb8xrcI3cuIybDdRPwBYxADCK1HpTtMqNCT39 IoM0uwWKBqlozr/Ly8aRC12o2RbH0+RYpYYIfJ0fZt1ALub8SQYlcuWcGYKJ+0EuhDSc M3mLyiN4ShoUd7uA1GATLMqFZOT2mkzMsBm68egMPKD9Uh3/Hn6C0ZMAJQD2V8n+COEe Rjp77MTf1I2uSQyFZmqALba+kzv+Nd088fMVlYfrAxQaotQVgthFAAlJjViRvwMUf2CH Tzvw== X-Gm-Message-State: AOAM530yipeUpF32/Lps1RxNUBbsKXjd4j0jroRtfj2PQN+sqd5ocEKJ 80c9zNTwIAnHMxTdw6sATjGLkbVdEgAGAw== X-Google-Smtp-Source: ABdhPJxvheQ548tVU0F3sUfSNeeyzYRs2JPHAldsQSo1hKrHqAEVEVgrIqC9DKXrXlsUPoOeDKMzHA== X-Received: by 2002:a1c:6a04:: with SMTP id f4mr335168wmc.56.1639419100775; Mon, 13 Dec 2021 10:11:40 -0800 (PST) Received: from localhost.localdomain ([217.113.240.86]) by smtp.gmail.com with ESMTPSA id t127sm8750956wma.9.2021.12.13.10.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 10:11:40 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: rodrigosiqueiramelo@gmail.com Subject: [PATCH 2/3] drm/vkms: add support for multiple overlay planes Date: Mon, 13 Dec 2021 19:11:30 +0100 Message-Id: <20211213181131.17223-3-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211213181131.17223-1-jose.exposito89@gmail.com> References: <20211213181131.17223-1-jose.exposito89@gmail.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: hamohammed.sa@gmail.com, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, melissa.srw@gmail.com, =?utf-8?b?Sm9zw6kg?= =?utf-8?b?RXhww7NzaXRv?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a new module parameter to allow to set the number of overlay planes to create. Set it to 1 by default in order to keep the "enable_overlay" backwards compatible. Signed-off-by: José Expósito --- drivers/gpu/drm/vkms/vkms_drv.c | 5 +++++ drivers/gpu/drm/vkms/vkms_drv.h | 1 + drivers/gpu/drm/vkms/vkms_output.c | 9 ++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 0ffe5f0e33f7..bb98f6c6c561 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -51,6 +51,10 @@ 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 num_overlay_planes = 1; +module_param_named(num_overlay_planes, num_overlay_planes, uint, 0444); +MODULE_PARM_DESC(num_overlay_planes, "Number of overlay planes to create"); + DEFINE_DRM_GEM_FOPS(vkms_driver_fops); static void vkms_release(struct drm_device *dev) @@ -229,6 +233,7 @@ static int __init vkms_init(void) config->cursor = enable_cursor; config->writeback = enable_writeback; config->overlay = enable_overlay; + config->num_overlay_planes = num_overlay_planes; return vkms_create(config); } diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index d48c23d40ce5..33bdf717e3cd 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -97,6 +97,7 @@ struct vkms_config { bool writeback; bool cursor; bool overlay; + unsigned int num_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 2e805b2d36ae..6f26998fdb7e 100644 --- a/drivers/gpu/drm/vkms/vkms_output.c +++ b/drivers/gpu/drm/vkms/vkms_output.c @@ -57,15 +57,18 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index) struct vkms_plane *primary, *cursor = NULL; int ret; int writeback; + unsigned int n; primary = vkms_plane_init(vkmsdev, DRM_PLANE_TYPE_PRIMARY, index); if (IS_ERR(primary)) return PTR_ERR(primary); if (vkmsdev->config->overlay) { - ret = vkms_add_overlay_plane(vkmsdev, index, crtc); - if (ret) - return ret; + for (n = 0; n < vkmsdev->config->num_overlay_planes; n++) { + ret = vkms_add_overlay_plane(vkmsdev, index, crtc); + if (ret) + return ret; + } } if (vkmsdev->config->cursor) { From patchwork Mon Dec 13 18:11:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12674497 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 53613C433FE for ; Mon, 13 Dec 2021 18:11:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3FA2710E834; Mon, 13 Dec 2021 18:11:49 +0000 (UTC) Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3AC5410E82E for ; Mon, 13 Dec 2021 18:11:43 +0000 (UTC) Received: by mail-wm1-x32a.google.com with SMTP id p18so12565528wmq.5 for ; Mon, 13 Dec 2021 10:11:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=anky/pj7/rcmax3ozqQQ2mqz0Ex4H2mV+LKwnahctPA=; b=C6Ksw4ZmqTccE99SjXGbEk3og3sAvMwKdQENu5l4qeq7vt6NrZtM6kQqobQj3FClPk eqg8aPYhegvZ2AsO/kk9ZcV21cX4u4pXU3Os7anXkoFvbMpLzkcIiM15QX6ynmQxs+mX vNHTXSgz2G7rNm2L/tnwB9qI4k7MPYLHBG7J+ay5J6+i7LuXAV1T/Z6pkbHYdW8xQace +kX1SxObYd1bmM7Oo1ikya0GqneMIquWMPoVvDCC6NnMZwfaIAfHVg37jwrJC+GfED89 PXQKql2/LqJs2Sp/kGnZq3aY8MVyCLPRM7H/AtEjAHtSZlYay/EgwpY2umLjCSpuXRcz uHVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=anky/pj7/rcmax3ozqQQ2mqz0Ex4H2mV+LKwnahctPA=; b=ZEOlvGuNxgpOhghZsj+pJl2GdcGWRRXUG+4fGmiUHSF7Q+SE18Ji6qlN1AbsOKZoDv BWch17fHL8V9XzuoCjGGtAcKDk9uvMffnkbyFSdYnGfRoEXlYs+eY2/yTpFG8tJIMUhM Fcqn30xX1tD74TBNVvWNn1F0hQ/EZGI+vbxl6UO/ZZQJZ6znCEga3ywKrOSvUAAkfr0A i5MJjj2AcpX50S7WT2PmkoBWwW5Zk7KQsSxc7JV+MmgeH2Y4fV2npIW17iD4zptogLXD zt7niiwXVGr1LL4LzjZVMfpkDk9ODmttfNN5aanVQTW8bGyJ2QuemAkd2R0SrsMNrm6T 74rg== X-Gm-Message-State: AOAM5319tmG7te5fy9cC9WyL7evLgtiPh9s1ulHBU/k1VyK6W0h4mFGw 3ZZock0r60jBnoBvlkhYWuc= X-Google-Smtp-Source: ABdhPJyoyFlW4lEPr6DsCtti6saUfqve3Q+d0k+LKKOlrYyVg9C0Nr+BYqJy0BUwrdTzoJLvxrMYxA== X-Received: by 2002:a1c:7907:: with SMTP id l7mr321247wme.72.1639419101745; Mon, 13 Dec 2021 10:11:41 -0800 (PST) Received: from localhost.localdomain ([217.113.240.86]) by smtp.gmail.com with ESMTPSA id t127sm8750956wma.9.2021.12.13.10.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 10:11:41 -0800 (PST) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: rodrigosiqueiramelo@gmail.com Subject: [PATCH 3/3] drm/vkms: drop "Multiple overlay planes" TODO Date: Mon, 13 Dec 2021 19:11:31 +0100 Message-Id: <20211213181131.17223-4-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211213181131.17223-1-jose.exposito89@gmail.com> References: <20211213181131.17223-1-jose.exposito89@gmail.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: hamohammed.sa@gmail.com, airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, melissa.srw@gmail.com, =?utf-8?b?Sm9zw6kg?= =?utf-8?b?RXhww7NzaXRv?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Signed-off-by: José Expósito --- Documentation/gpu/vkms.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/Documentation/gpu/vkms.rst b/Documentation/gpu/vkms.rst index 941f0e7e5eef..9c873c3912cc 100644 --- a/Documentation/gpu/vkms.rst +++ b/Documentation/gpu/vkms.rst @@ -124,8 +124,6 @@ Add Plane Features There's lots of plane features we could add support for: -- Multiple overlay planes. [Good to get started] - - Clearing primary plane: clear primary plane before plane composition (at the start) for correctness of pixel blend ops. It also guarantees alpha channel is cleared in the target buffer for stable crc. [Good to get started]