mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Louis Chauvet <louis.chauvet@bootlin.com>
Cc: "Rodrigo Siqueira" <rodrigosiqueiramelo@gmail.com>,
	"Melissa Wen" <melissa.srw@gmail.com>,
	"Maíra Canal" <mairacanal@riseup.net>,
	"Haneen Mohammed" <hamohammed.sa@gmail.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Simona Vetter" <simona.vetter@ffwll.ch>,
	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, nicolejadeyee@google.com
Subject: Re: [PATCH v6 7/8] drm: writeback: Create drmm variants for drm_writeback_connector initialization
Date: Mon, 6 Jan 2025 14:04:21 +0100	[thread overview]
Message-ID: <20250106-acoustic-inescapable-locust-9d5b36@houat> (raw)
In-Reply-To: <20241230-google-vkms-managed-v6-7-15c7d65cd63b@bootlin.com>

[-- Attachment #1: Type: text/plain, Size: 2961 bytes --]

On Mon, Dec 30, 2024 at 07:37:37PM +0100, Louis Chauvet wrote:
> To allows driver to only use drmm objects, add helper to create
> drm_writeback_connectors with automated lifetime management.
> 
> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> ---
>  drivers/gpu/drm/drm_writeback.c | 69 +++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_writeback.h     |  8 +++++
>  2 files changed, 77 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_writeback.c b/drivers/gpu/drm/drm_writeback.c
> index 9c69f7181e02c23dabce488405608c40d4184af5..1251f65aae9e3b6fb5c5de9ab9280e5430342208 100644
> --- a/drivers/gpu/drm/drm_writeback.c
> +++ b/drivers/gpu/drm/drm_writeback.c
> @@ -369,6 +369,75 @@ static void drm_writeback_connector_cleanup(struct drm_device *dev,
>  	spin_unlock_irqrestore(&wb_connector->job_lock, flags);
>  }
>  
> +/**
> + * drmm_writeback_connector_init - Initialize a writeback connector with
> + * a custom encoder
> + *
> + * @dev: DRM device
> + * @wb_connector: Writeback connector to initialize
> + * @con_funcs: Connector funcs vtable
> + * @enc: handle to the already initialized drm encoder, optional
> + * @enc_funcs: Encoder funcs vtable, optional, only used when @enc is NULL
> + * @formats: Array of supported pixel formats for the writeback engine
> + * @n_formats: Length of the formats array
> + * @possible_crtcs: if @enc is NULL, this will set the possible_crtc for the
> + *		    newly created encoder
> + *
> + * This function initialize a writeback connector and register its cleanup.
> + *
> + * This function creates the writeback-connector-specific properties if they
> + * have not been already created, initializes the connector as
> + * type DRM_MODE_CONNECTOR_WRITEBACK, and correctly initializes the property
> + * values.
> + *
> + * If @enc is NULL, this function will create a drm-managed encoder and will
> + * attach @enc_funcs on it. It will also attach the CRTC passed in
> + * @possible_crtcs
> + *
> + * Returns: 0 on success, or a negative error code
> + */
> +int drmm_writeback_connector_init(struct drm_device *dev,
> +				  struct drm_writeback_connector *wb_connector,
> +				  const struct drm_connector_funcs *con_funcs,
> +				  struct drm_encoder *enc,
> +				  const struct drm_encoder_helper_funcs *enc_funcs,
> +				  const u32 *formats, int n_formats,
> +				  u32 possible_crtcs)

The name isn't really consistent with the other functions. We already
have a drm_writeback_connector_init that doesn't take the encoder point
but will just read it from wb_connector->encoder, and we have
drm_writeback_connector_with_encoder that assumes the encoder has
already been created.

We should the name or behavior on either one of them. Why do we need an
optional encoder pointer? If enc is not NULL, then enc_funcs shouldn't
be necessary, if it's NULL, then drm_writeback_connector_init will be
sufficient?

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

  reply	other threads:[~2025-01-06 13:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 18:37 [PATCH v6 0/8] drm/vkms: Switch all vkms object to DRM managed objects Louis Chauvet
2024-12-30 18:37 ` [PATCH v6 1/8] drm/vkms: Switch to managed for connector Louis Chauvet
2024-12-30 18:37 ` [PATCH v6 2/8] drm/vkms: Switch to managed for encoder Louis Chauvet
2024-12-30 18:37 ` [PATCH v6 3/8] drm/vkms: Switch to managed for crtc Louis Chauvet
2024-12-30 18:37 ` [PATCH v6 4/8] drm: writeback: Introduce cleanup function Louis Chauvet
2025-01-06  9:43   ` Maxime Ripard
2025-01-06 12:46     ` Louis Chauvet
2024-12-30 18:37 ` [PATCH v6 5/8] drm: writeback: Create an helper for drm_writeback_connector initialization Louis Chauvet
2025-01-06 12:56   ` Maxime Ripard
2024-12-30 18:37 ` [PATCH v6 6/8] drm: writeback: Add missing cleanup in case of initialization failure Louis Chauvet
2025-01-06 12:58   ` Maxime Ripard
2024-12-30 18:37 ` [PATCH v6 7/8] drm: writeback: Create drmm variants for drm_writeback_connector initialization Louis Chauvet
2025-01-06 13:04   ` Maxime Ripard [this message]
2025-01-06 16:19     ` Louis Chauvet
2025-01-07 15:36       ` Maxime Ripard
2024-12-30 18:37 ` [PATCH v6 8/8] drm/vkms: Switch to managed for writeback connector Louis Chauvet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250106-acoustic-inescapable-locust-9d5b36@houat \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=arthurgrillo@riseup.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=jeremie.dautheribes@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mairacanal@riseup.net \
    --cc=melissa.srw@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=nicolejadeyee@google.com \
    --cc=rodrigosiqueiramelo@gmail.com \
    --cc=seanpaul@google.com \
    --cc=simona.vetter@ffwll.ch \
    --cc=simona@ffwll.ch \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®