mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: "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>,
	"Maxime Ripard" <mripard@kernel.org>,
	"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,
	"Maíra Canal" <mcanal@igalia.com>
Subject: Re: [PATCH v7 3/7] drm/vkms: Switch to managed for crtc
Date: Tue, 14 Jan 2025 14:25:14 +0100	[thread overview]
Message-ID: <aa787d6d-5195-4f1f-8df1-5b9fcd51e6d4@suse.de> (raw)
In-Reply-To: <Z4ZkfK5p--NMTSKo@louis-chauvet-laptop>

Hi


Am 14.01.25 um 14:19 schrieb Louis Chauvet:
> On 14/01/25 - 10:06, Thomas Zimmermann wrote:
>> Hi
>>
>>
>> Am 13.01.25 um 18:09 schrieb Louis Chauvet:
>>> The current VKMS driver uses managed function to create crtc, but
>>> don't use it to properly clean the crtc workqueue. It is not an
>>> issue yet, but in order to support multiple devices easily,
>>> convert this code to use drm and device managed helpers.
>>>
>>> Reviewed-by: Maxime Ripard <mripard@kernel.org>
>>> Reviewed-by: Maíra Canal <mcanal@igalia.com>
>>> Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
>>> ---
>>>    drivers/gpu/drm/vkms/vkms_crtc.c | 14 ++++++++++++++
>>>    drivers/gpu/drm/vkms/vkms_drv.c  |  9 ---------
>>>    2 files changed, 14 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
>>> index 28a57ae109fcc05af3fe74f94518c462c09119e3..ace8d293f7da611110c1e117b6cf2f3c9e9b4381 100644
>>> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
>>> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
>>> @@ -6,6 +6,7 @@
>>>    #include <drm/drm_atomic_helper.h>
>>>    #include <drm/drm_probe_helper.h>
>>>    #include <drm/drm_vblank.h>
>>> +#include <drm/drm_managed.h>
>> Alphabetical order please.
>>
>>>    #include "vkms_drv.h"
>>> @@ -270,6 +271,14 @@ static const struct drm_crtc_helper_funcs vkms_crtc_helper_funcs = {
>>>    	.atomic_disable	= vkms_crtc_atomic_disable,
>>>    };
>>> +static void vkms_crtc_destroy_workqueue(struct drm_device *dev,
>>> +					void *raw_vkms_out)
>>> +{
>>> +	struct vkms_output *vkms_out = raw_vkms_out;
>>> +
>>> +	destroy_workqueue(vkms_out->composer_workq);
>>> +}
>>> +
>> This could be implemented in drm_managed.c. drmm_alloc_ordered_workqueue()
>> would call alloc_ordered_workqueue() and set up the managed callback as
>> well.
> Hello Thomas,
>
> Thanks for this review. For the next iteration, I will add the macro
> drmm_alloc_ordered_workqueue:
>
> void __drmm_destroy_workqueue(struct drm_device *device, void* res)
> {
> 	struct workqueue_struct *wq = res;
>
> 	destroy_workqueue(wq);
> }
> EXPORT_SYMBOL(__drmm_destroy_workqueue);
>
> #define drmm_alloc_ordered_workqueue(dev, fmt, flags, args...)					\
> 	({											\
> 		struct workqueue_struct *wq = alloc_ordered_workqueue(fmt, flags, ##args);	\
> 		wq ? ({										\
> 			int ret = drmm_add_action_or_reset(dev, __drmm_destroy_workqueue, wq);	\
> 			ret ? ERR_PTR(ret) : wq;						\
> 		}) :										\
> 			wq;									\
> 	})

Great. There are quite a few work queues in DRM drivers. Hopefully 
soemone else will find this useful. With this change and the fixed 
include sorting, you can add my R-b to this patch.

>
> Besides this, is there anything else you noticed that I should change
> for the next iteration in the remaining patches?

I've looked through the other patches and they look good to me. Feel 
free to add Acked-by: Thomas Zimmermann <tzimmermann@suse.de> to patches 
4 to 7.

Best regards
Thomas

>
> Thanks,
> Louis Chauvet
>
>> Best regards
>> Thomas
>>
>>>    int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
>>>    		   struct drm_plane *primary, struct drm_plane *cursor)
>>>    {
>>> @@ -300,5 +309,10 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
>>>    	if (!vkms_out->composer_workq)
>>>    		return -ENOMEM;
>>> +	ret = drmm_add_action_or_reset(dev, vkms_crtc_destroy_workqueue,
>>> +				       vkms_out);
>>> +	if (ret)
>>> +		return ret;
>>> +
>>>    	return ret;
>>>    }
>>> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
>>> index e0409aba93496932b32a130ebb608ee53b1a9c59..7c142bfc3bd9de9556621db3e7f570dc0a4fab3a 100644
>>> --- a/drivers/gpu/drm/vkms/vkms_drv.c
>>> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
>>> @@ -53,14 +53,6 @@ MODULE_PARM_DESC(enable_overlay, "Enable/Disable overlay support");
>>>    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);
>>> -
>>> -	if (vkms->output.composer_workq)
>>> -		destroy_workqueue(vkms->output.composer_workq);
>>> -}
>>> -
>>>    static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)
>>>    {
>>>    	struct drm_device *dev = old_state->dev;
>>> @@ -108,7 +100,6 @@ static const struct drm_debugfs_info vkms_config_debugfs_list[] = {
>>>    static const struct drm_driver vkms_driver = {
>>>    	.driver_features	= DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
>>> -	.release		= vkms_release,
>>>    	.fops			= &vkms_driver_fops,
>>>    	DRM_GEM_SHMEM_DRIVER_OPS,
>>>    	DRM_FBDEV_SHMEM_DRIVER_OPS,
>>>
>> -- 
>> --
>> Thomas Zimmermann
>> Graphics Driver Developer
>> SUSE Software Solutions Germany GmbH
>> Frankenstrasse 146, 90461 Nuernberg, Germany
>> GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
>> HRB 36809 (AG Nuernberg)
>>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


  reply	other threads:[~2025-01-14 13:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 17:09 [PATCH v7 0/7] drm/vkms: Switch all vkms object to DRM managed objects Louis Chauvet
2025-01-13 17:09 ` [PATCH v7 1/7] drm/vkms: Switch to managed for connector Louis Chauvet
2025-01-14  8:54   ` Thomas Zimmermann
2025-01-13 17:09 ` [PATCH v7 2/7] drm/vkms: Switch to managed for encoder Louis Chauvet
2025-01-14  8:56   ` Thomas Zimmermann
2025-01-13 17:09 ` [PATCH v7 3/7] drm/vkms: Switch to managed for crtc Louis Chauvet
2025-01-14  9:06   ` Thomas Zimmermann
2025-01-14 13:19     ` Louis Chauvet
2025-01-14 13:25       ` Thomas Zimmermann [this message]
2025-01-13 17:09 ` [PATCH v7 4/7] drm: writeback: Create an helper for drm_writeback_connector initialization Louis Chauvet
2025-01-15  1:22   ` kernel test robot
2025-01-13 17:09 ` [PATCH v7 5/7] drm: writeback: Add missing cleanup in case of initialization failure Louis Chauvet
2025-01-13 17:09 ` [PATCH v7 6/7] drm: writeback: Create drmm variants for drm_writeback_connector initialization Louis Chauvet
2025-01-13 17:09 ` [PATCH v7 7/7] drm/vkms: Switch to managed for writeback connector Louis Chauvet
2025-01-13 17:12   ` Louis Chauvet
2025-01-16 15:53     ` José Expósito

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=aa787d6d-5195-4f1f-8df1-5b9fcd51e6d4@suse.de \
    --to=tzimmermann@suse.de \
    --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=maarten.lankhorst@linux.intel.com \
    --cc=mairacanal@riseup.net \
    --cc=mcanal@igalia.com \
    --cc=melissa.srw@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mripard@kernel.org \
    --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 \
    /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®