mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: "Rodrigo Siqueira" <rodrigosiqueiramelo@gmail.com>,
	"Melissa Wen" <melissa.srw@gmail.com>,
	"Maíra Canal" <mairacanal@riseup.net>,
	"Haneen Mohammed" <hamohammed.sa@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	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 v2 1/6] drm/vkms: Switch to managed for connector
Date: Tue, 27 Aug 2024 16:39:44 +0200	[thread overview]
Message-ID: <20240827-chubby-tidy-collie-c8ecf7@houat> (raw)
In-Reply-To: <Zs3TeoUwn3iO7oBs@louis-chauvet-laptop>

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

On Tue, Aug 27, 2024 at 03:24:10PM GMT, Louis Chauvet wrote:
> Le 27/08/24 - 15:15, Maxime Ripard a écrit :
> > Hi,
> > 
> > On Tue, Aug 27, 2024 at 11:57:36AM GMT, Louis Chauvet wrote:
> > > The current VKMS driver uses non-managed function to create connectors. It
> > > is not an issue yet, but in order to support multiple devices easily,
> > > convert this code to use drm and device managed helpers.
> > > 
> > > Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
> > > ---
> > >  drivers/gpu/drm/vkms/vkms_drv.h    |  1 -
> > >  drivers/gpu/drm/vkms/vkms_output.c | 22 ++++++++++++----------
> > >  2 files changed, 12 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
> > > index 5e46ea5b96dc..9a3c6c34d1f6 100644
> > > --- a/drivers/gpu/drm/vkms/vkms_drv.h
> > > +++ b/drivers/gpu/drm/vkms/vkms_drv.h
> > > @@ -99,7 +99,6 @@ struct vkms_crtc_state {
> > >  struct vkms_output {
> > >  	struct drm_crtc crtc;
> > >  	struct drm_encoder encoder;
> > > -	struct drm_connector connector;
> > >  	struct drm_writeback_connector wb_connector;
> > >  	struct hrtimer vblank_hrtimer;
> > >  	ktime_t period_ns;
> > > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> > > index 5ce70dd946aa..4fe6b88e8081 100644
> > > --- a/drivers/gpu/drm/vkms/vkms_output.c
> > > +++ b/drivers/gpu/drm/vkms/vkms_output.c
> > > @@ -3,11 +3,11 @@
> > >  #include "vkms_drv.h"
> > >  #include <drm/drm_atomic_helper.h>
> > >  #include <drm/drm_edid.h>
> > > +#include <drm/drm_managed.h>
> > >  #include <drm/drm_probe_helper.h>
> > >  
> > >  static const struct drm_connector_funcs vkms_connector_funcs = {
> > >  	.fill_modes = drm_helper_probe_single_connector_modes,
> > > -	.destroy = drm_connector_cleanup,
> > >  	.reset = drm_atomic_helper_connector_reset,
> > >  	.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> > >  	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> > > @@ -50,7 +50,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
> > >  {
> > >  	struct vkms_output *output = &vkmsdev->output;
> > >  	struct drm_device *dev = &vkmsdev->drm;
> > > -	struct drm_connector *connector = &output->connector;
> > > +	struct drm_connector *connector;
> > >  	struct drm_encoder *encoder = &output->encoder;
> > >  	struct drm_crtc *crtc = &output->crtc;
> > >  	struct vkms_plane *primary, *cursor = NULL;
> > > @@ -80,8 +80,15 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
> > >  	if (ret)
> > >  		return ret;
> > >  
> > > -	ret = drm_connector_init(dev, connector, &vkms_connector_funcs,
> > > -				 DRM_MODE_CONNECTOR_VIRTUAL);
> > > +	connector = drmm_kzalloc(dev, sizeof(*connector), GFP_KERNEL);
> > > +	if (!connector) {
> > > +		DRM_ERROR("Failed to allocate connector\n");
> > > +		ret = -ENOMEM;
> > > +		goto err_connector;
> > > +	}
> > > +
> > 
> > I think it would be worth explaining why you need to move to a separate
> > allocation for the connector now.
> > 
> > Maxime
> 
> Hi,
> 
> This is in preparation for ConfigFS implementation, as the number of 
> connector/encoders/crtc/planes... will be dynamic, we need to have 
> separate alloaction.
> 
> If I add this paragraph in the commit message, is it sufficient?
> 
> 	A specific allocation for the connector is not strictly necessary 
> 	at this point, but in order to implement dynamic configuration of 
> 	VKMS (configFS), it will be easier to have one allocation per 
> 	connector.
> 
> (same for encoder & CRTC)

Yeah, that's a good message, but it probably belongs in a separate patch
then.

Thanks!
Maxime

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

  reply	other threads:[~2024-08-27 14:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  9:57 [PATCH v2 0/6] drm/vkms: Switch all vkms object to DRM managed objects Louis Chauvet
2024-08-27  9:57 ` [PATCH v2 1/6] drm/vkms: Switch to managed for connector Louis Chauvet
2024-08-27 13:15   ` Maxime Ripard
2024-08-27 13:24     ` Louis Chauvet
2024-08-27 14:39       ` Maxime Ripard [this message]
2024-08-27 15:08         ` Louis Chauvet
2024-08-27 16:42           ` Maxime Ripard
2024-08-27  9:57 ` [PATCH v2 2/6] drm/vkms: Switch to managed for encoder Louis Chauvet
2024-08-27 13:16   ` Maxime Ripard
2024-08-27  9:57 ` [PATCH v2 3/6] drm/vkms: Rename vkms_output to vkms_crtc Louis Chauvet
2024-08-27  9:57 ` [PATCH v2 4/6] drm/vkms: rename to_vkms_crtc_state to drm_crtc_state_to_vkms_crtc_state to avoid confusion Louis Chauvet
2024-08-27  9:57 ` [PATCH v2 5/6] drm/vkms: Switch to managed for CRTC Louis Chauvet
2024-08-30 21:37   ` kernel test robot
2024-08-30 23:09   ` kernel test robot
2024-08-27  9:57 ` [PATCH v2 6/6] drm/vkms: Add missing check for CRTC initialization 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=20240827-chubby-tidy-collie-c8ecf7@houat \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=arthurgrillo@riseup.net \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=jeremie.dautheribes@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --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=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®