dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Louis Chauvet <louis.chauvet@bootlin.com>
To: Marius Vlad <marius.vlad@collabora.com>
Cc: dri-devel@lists.freedesktop.org,
	dmitry.baryshkov@oss.qualcomm.com, tzimmermann@suse.de,
	simona.vetter@ffwll.ch, jani.nikula@linux.intel.com,
	ian.forbes@broadcom.com, daniel.stone@collabora.com
Subject: Re: [PATCH v4 3/3] drm/vkms: Add polling for HPD
Date: Thu, 6 Nov 2025 10:02:36 +0100	[thread overview]
Message-ID: <1e76e3de-6bf6-4886-83ed-407c96a049ae@bootlin.com> (raw)
In-Reply-To: <aQoLifqzUrYpZnWW@xpredator>



Le 04/11/2025 à 15:19, Marius Vlad a écrit :
> On Tue, Nov 04, 2025 at 11:21:28AM +0100, Louis Chauvet wrote:
>>
>>
>> Le 03/11/2025 à 18:45, Marius Vlad a écrit :
>>> vkms is missing any kind of HPD (polling/irq), so add polling to handle
>>> hotplug events.
>>
>> Hi,
> Hi Louis, thanks for the quick reply!
>>
>> I am a bit surprised by this addition, we currently have hotplug/unplug in
>> VKMS using configFS, and it seems to work. The current "irq" system is
>> writing in configFS the status and call drm_kms_helper_hotplug_event after
>> the status is updated [1].
> The situation is that the VKMS connectors/card are also being exposed
> through sysfs similar to real devices. That's where we trigger/simulate
> a connector hot-plug without physically unplugging cables. Wasn't aware
> that VKMS had something similar to that with ConfigFS, so that needs
> adjusting.

Yes, that very recent, I am not surprised that you missed it.

>> I think the polling will not work, I read in the drm_kms_helper_poll_init
>> documentation that the connector is not polled if some connector flags are
>> not set [2]/[3].
> In this case the loop will be no-op, but prior to the loop
> `changed` is set to `changed = dev->mode_config.delayed_event` [1] so
> the code at [2] will do run.

Ho, make sense, thanks for the explanation!

>>
>> If the polling works, I don't think it will be enough for the current VKMS
>> implementation. Currently setting status using configFS will do everything
>> synchronously:
>> - Set the connector status (next call to connector->detect will have the new
>> value)
>> - Call drm_kms_helper_hotplug_event
>>
>> With your implementation, I think you expect something to update
>> connector->status_changed in between, using polling if I understood
>> correctly, which will probably happen after the call to
>> drm_kms_helper_hotplug_event.
> Right, that's another path for VKMS.

Let me know if you have any question about the current implementation, I 
can help if needed.

> [1] https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L769
> [2] https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L846
> 
>>
>> [1]:https://gitlab.freedesktop.org/drm/misc/kernel/-/blob/drm-misc-next/drivers/gpu/drm/vkms/vkms_connector.c?ref_type=heads#L91-96
>> [2]:https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L917-L918
>> [3]:https://elixir.bootlin.com/linux/v6.17.7/source/drivers/gpu/drm/drm_probe_helper.c#L793
>>
>>> Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
>>> ---
>>>    drivers/gpu/drm/vkms/vkms_drv.c | 4 ++++
>>>    1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
>>> index e8472d9b6e3b..ec815c42ef04 100644
>>> --- a/drivers/gpu/drm/vkms/vkms_drv.c
>>> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
>>> @@ -198,6 +198,9 @@ static int vkms_create(struct vkms_config *config)
>>>    	if (ret)
>>>    		goto out_devres;
>>> +	/* init kms poll for handling hpd */
>>> +	drm_kms_helper_poll_init(&vkms_device->drm);
>>> +
>>>    	drm_client_setup(&vkms_device->drm, NULL);
>>>    	return 0;
>>> @@ -240,6 +243,7 @@ static void vkms_destroy(struct vkms_config *config)
>>>    	fdev = config->dev->faux_dev;
>>> +	drm_kms_helper_poll_fini(&config->dev->drm);
>>>    	drm_dev_unregister(&config->dev->drm);
>>>    	drm_atomic_helper_shutdown(&config->dev->drm);
>>>    	devres_release_group(&fdev->dev, NULL);
>>
>> -- 
>> --
>> Louis Chauvet, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
>>

-- 
--
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


      reply	other threads:[~2025-11-06  9:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-03 17:45 [PATCH v4 0/3] Pass down hot plug CONNECTOR ID to user-space Marius Vlad
2025-11-03 17:45 ` [PATCH v4 1/3] drm: Introduce a new connector status Marius Vlad
2025-11-03 17:45 ` [PATCH v4 2/3] drm: Propagate connector status change Marius Vlad
2025-11-03 17:45 ` [PATCH v4 3/3] drm/vkms: Add polling for HPD Marius Vlad
2025-11-04 10:21   ` Louis Chauvet
2025-11-04 14:19     ` Marius Vlad
2025-11-06  9:02       ` Louis Chauvet [this message]

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=1e76e3de-6bf6-4886-83ed-407c96a049ae@bootlin.com \
    --to=louis.chauvet@bootlin.com \
    --cc=daniel.stone@collabora.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ian.forbes@broadcom.com \
    --cc=jani.nikula@linux.intel.com \
    --cc=marius.vlad@collabora.com \
    --cc=simona.vetter@ffwll.ch \
    --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