Linux-HyperV List
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Javier Martinez Canillas <javierm@redhat.com>,
	louis.chauvet@bootlin.com, drawat.floss@gmail.com,
	hamohammed.sa@gmail.com, melissa.srw@gmail.com,
	mhklinux@outlook.com, simona@ffwll.ch, airlied@gmail.com,
	maarten.lankhorst@linux.intel.com
Cc: dri-devel@lists.freedesktop.org, linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v2 4/4] drm/hypervdrm: Use vblank timer
Date: Tue, 2 Sep 2025 14:58:03 +0200	[thread overview]
Message-ID: <5cd7f22d-e39a-4d37-8286-0194d6c9a818@suse.de> (raw)
In-Reply-To: <87a53dfe87.fsf@minerva.mail-host-address-is-not-set>

Hi

Am 02.09.25 um 10:30 schrieb Javier Martinez Canillas:
> Thomas Zimmermann <tzimmermann@suse.de> writes:
>
>> HyperV's virtual hardware does not provide vblank interrupts. Use a
>> vblank timer to simulate the interrupt. Rate-limits the display's
>> update frequency to the display-mode settings. Avoids excessive CPU
>> overhead with compositors that do not rate-limit their output.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
>
> [...]
>
>>   
>> @@ -111,11 +113,15 @@ static void hyperv_crtc_helper_atomic_enable(struct drm_crtc *crtc,
>>   				crtc_state->mode.hdisplay,
>>   				crtc_state->mode.vdisplay,
>>   				plane_state->fb->pitches[0]);
>> +
>> +	drm_crtc_vblank_on(crtc);
>>   }
>>   
>>   static const struct drm_crtc_helper_funcs hyperv_crtc_helper_funcs = {
>>   	.atomic_check = drm_crtc_helper_atomic_check,
>> +	.atomic_flush = drm_crtc_vblank_atomic_flush,
>>   	.atomic_enable = hyperv_crtc_helper_atomic_enable,
>> +	.atomic_disable = drm_crtc_vblank_atomic_disable,
>>   };
>>   
> I think your patch is correct due the driver not having an .atomic_disable
> callback. But looking at the driver, I see that its .atomic_enable does:
>
> static void hyperv_crtc_helper_atomic_enable(struct drm_crtc *crtc,
>                                               struct drm_atomic_state *state)
> {
> ...
>          hyperv_update_situation(hv->hdev, 1,  hv->screen_depth,
>                                  crtc_state->mode.hdisplay,
>                                  crtc_state->mode.vdisplay,
>                                  plane_state->fb->pitches[0]);
> }
>
> and this function in turn does:
>
> int hyperv_update_situation(struct hv_device *hdev, u8 active, u32 bpp,
>                              u32 w, u32 h, u32 pitch)
> {
> ...
>          msg.situ.video_output[0].active = active;
> ...
> }
>
> So I wonder if it should instead have a custom .atomic_disable that calls:
>
>          hyperv_update_situation(hv->hdev, 0,  hv->screen_depth,
>                                  crtc_state->mode.hdisplay,
>                                  crtc_state->mode.vdisplay,
>                                  plane_state->fb->pitches[0]);
>
> I'm not familiar with hyperv to know whether is a problem or not for the
> host to not be notified that the guest display is disabled. But I thought
> that should raise this question for the folks familiar with it.

The feedback I got at 
https://lore.kernel.org/dri-devel/SN6PR02MB4157F630284939E084486AFED46FA@SN6PR02MB4157.namprd02.prod.outlook.com/ 
is that the vblank timer solves the problem of excessive CPU consumption 
on hypervdrm. Ans that's also the observation I had with other drivers. 
I guess, telling the host about the disabled display would still make sense.

Best regards
Thomas


>

-- 
--
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-09-02 12:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 11:06 [PATCH v2 0/4] drm: Add vblank timers for devices without interrupts Thomas Zimmermann
2025-09-01 11:06 ` [PATCH v2 1/4] drm/vblank: Add vblank timer Thomas Zimmermann
2025-09-02  8:09   ` Javier Martinez Canillas
2025-09-02 13:27   ` Ville Syrjälä
2025-09-02 14:16     ` Thomas Zimmermann
2025-09-02 15:58       ` Lyude Paul
2025-09-04 14:21         ` Thomas Zimmermann
2025-09-01 11:06 ` [PATCH v2 2/4] drm/vblank: Add CRTC helpers for simple use cases Thomas Zimmermann
2025-09-02  8:14   ` Javier Martinez Canillas
2025-09-01 11:07 ` [PATCH v2 3/4] drm/vkms: Convert to DRM's vblank timer Thomas Zimmermann
2025-09-02  8:15   ` Javier Martinez Canillas
2025-09-01 11:07 ` [PATCH v2 4/4] drm/hypervdrm: Use " Thomas Zimmermann
2025-09-02  8:30   ` Javier Martinez Canillas
2025-09-02 12:58     ` Thomas Zimmermann [this message]
2025-09-02 15:41       ` Javier Martinez Canillas
2025-09-04  3:38         ` Michael Kelley
2025-09-04  5:50           ` Javier Martinez Canillas

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=5cd7f22d-e39a-4d37-8286-0194d6c9a818@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=drawat.floss@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hamohammed.sa@gmail.com \
    --cc=javierm@redhat.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=louis.chauvet@bootlin.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=melissa.srw@gmail.com \
    --cc=mhklinux@outlook.com \
    --cc=simona@ffwll.ch \
    /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