All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: daniel@ffwll.ch, airlied@redhat.com, noralf@tronnes.org,
	rong.a.chen@intel.com, feng.tang@intel.com, ying.huang@intel.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH 1/2] drm/fb-helper: Synchronize dirty worker with vblank
Date: Mon,  9 Sep 2019 16:06:32 +0200	[thread overview]
Message-ID: <20190909140633.31260-2-tzimmermann@suse.de> (raw)
In-Reply-To: <20190909140633.31260-1-tzimmermann@suse.de>

Before updating the display from the console's shadow buffer, the dirty
worker now waits for vblank. This allows several screen updates to pile
up and acts as a rate limiter.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_fb_helper.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index a7ba5b4902d6..017e2f6bd1b9 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -402,8 +402,20 @@ static void drm_fb_helper_dirty_work(struct work_struct *work)
 						    dirty_work);
 	struct drm_clip_rect *clip = &helper->dirty_clip;
 	struct drm_clip_rect clip_copy;
+	struct drm_crtc *crtc;
 	unsigned long flags;
 	void *vaddr;
+	int ret;
+
+	/* rate-limit update frequency */
+	mutex_lock(&helper->lock);
+	crtc = helper->client.modesets[0].crtc;
+	ret = drm_crtc_vblank_get(crtc);
+	if (!ret) {
+		drm_crtc_wait_one_vblank(crtc);
+		drm_crtc_vblank_put(crtc);
+	}
+	mutex_unlock(&helper->lock);
 
 	spin_lock_irqsave(&helper->dirty_lock, flags);
 	clip_copy = *clip;
-- 
2.23.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-09-09 14:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09 14:06 [PATCH 0/2] Rate-limit shadow-FB-to-console-update to screen refresh Thomas Zimmermann
2019-09-09 14:06 ` Thomas Zimmermann [this message]
2019-09-10 11:52   ` [PATCH 1/2] drm/fb-helper: Synchronize dirty worker with vblank Gerd Hoffmann
2019-09-10 12:48     ` Thomas Zimmermann
2019-09-10 13:34       ` Noralf Trønnes
2019-09-10 13:51         ` Thomas Zimmermann
2019-09-10 14:59           ` Noralf Trønnes
2019-09-17 12:55             ` Daniel Vetter
2019-09-17 13:25               ` Noralf Trønnes
2019-09-09 14:06 ` [PATCH 2/2] drm/mgag200: Add vblank support Thomas Zimmermann
2019-09-10 11:47   ` Gerd Hoffmann
2019-09-10 14:01   ` Ville Syrjälä
2019-09-10 14:38     ` Thomas Zimmermann
2019-09-11 15:08     ` Thomas Zimmermann
2019-09-11 15:21       ` Ville Syrjälä
2019-09-11 17:31         ` Thomas Zimmermann
2019-09-10 15:12   ` Ville Syrjälä

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=20190909140633.31260-2-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=feng.tang@intel.com \
    --cc=noralf@tronnes.org \
    --cc=rong.a.chen@intel.com \
    --cc=ying.huang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.