[PATCH v4 1/5] drm/vkms: Switch to managed for connector
Louis Chauvet
louis.chauvet at bootlin.com
Mon Oct 28 09:50:35 UTC 2024
On 26/10/24 - 12:29, Maíra Canal wrote:
> Hi Louis,
>
> On 10/10/24 14:39, 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 at bootlin.com>
> > ---
> > drivers/gpu/drm/vkms/vkms_output.c | 19 +++++++------------
> > 1 file changed, 7 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_output.c b/drivers/gpu/drm/vkms/vkms_output.c
> > index 5128aa3b2eb6..8f7a05b73e1d 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,
> > @@ -70,17 +70,17 @@ int vkms_output_init(struct vkms_device *vkmsdev)
> > if (IS_ERR(overlay)) {
> > DRM_DEV_ERROR(dev->dev, "Failed to init vkms plane\n");
> > ret = PTR_ERR(overlay);
> > - goto err_crtc;
> > + goto err_connector;
>
> Why did you renamed err_crtc to err_connector? I think err_crtc looks
> correct.
I rename it many times during my work, it was never clear for me if
"err_crtc" is about an error during the CRTC initialization or a label to
clean the crtc.
If for you err_crtc is correct (ie err_<thing> means "cleanup <thing>"), I
will switch to this pattern.
Thanks,
Louis Chauvet
> Best Regards,
> - Maíra
>
> > }
> > overlay->base.possible_crtcs = drm_crtc_mask(crtc);
> > }
> > }
> > - ret = drm_connector_init(dev, connector, &vkms_connector_funcs,
> > - DRM_MODE_CONNECTOR_VIRTUAL);
> > + ret = drmm_connector_init(dev, connector, &vkms_connector_funcs,
> > + DRM_MODE_CONNECTOR_VIRTUAL, NULL);
> > if (ret) {
> > DRM_ERROR("Failed to init connector\n");
> > - goto err_crtc;
> > + goto err_connector;
> > }
> > drm_connector_helper_add(connector, &vkms_conn_helper_funcs);
> > @@ -89,7 +89,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)
> > DRM_MODE_ENCODER_VIRTUAL, NULL);
> > if (ret) {
> > DRM_ERROR("Failed to init encoder\n");
> > - goto err_encoder;
> > + return ret;
> > }
> > encoder->possible_crtcs = drm_crtc_mask(crtc);
> > @@ -111,12 +111,7 @@ int vkms_output_init(struct vkms_device *vkmsdev)
> > err_attach:
> > drm_encoder_cleanup(encoder);
> > -
> > -err_encoder:
> > - drm_connector_cleanup(connector);
> > -
> > -err_crtc:
> > +err_connector:
> > drm_crtc_cleanup(crtc);
> > -
> > return ret;
> > }
> >
More information about the dri-devel
mailing list