All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: Mark yao <mark.yao@rock-chips.com>
Cc: John Keeping <john@metanate.com>, Daniel Vetter <daniel@ffwll.ch>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Thierry Reding <thierry.reding@gmail.com>
Subject: [PATCH v2 2/3] drm/rockchip: don't wait for vblank if fb hasn't changed
Date: Tue, 19 Jan 2016 10:46:59 +0000	[thread overview]
Message-ID: <6865056b134065bcc8fff798314945e2ba5318cf.1453200263.git.john@metanate.com> (raw)
In-Reply-To: <cover.1453200263.git.john@metanate.com>
In-Reply-To: <cover.1453200263.git.john@metanate.com>

As commented in drm_atomic_helper_wait_for_vblanks(), userspace relies
on cursor ioctls being unsynced.  Converting the rockchip driver to
atomic has significantly impacted cursor performance by making every
cursor update wait for vblank.

By skipping the vblank sync when the framebuffer has not changed (as is
done in drm_atomic_helper_wait_for_vblanks()) we can avoid this for the
common case of moving the cursor and only need to delay the cursor ioctl
when the cursor icon changes.

We cannot add the check on legacy_cursor_update since that results in
the cursor bo being unreferenced while the hardware may still be reading
it.  Fully supporting unsynced cursor updates is left for the future
when the atomic helper framework supports async updates.

Signed-off-by: John Keeping <john@metanate.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
---
Unchanged since v1.

 drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index f784488..679d23a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -178,7 +178,7 @@ static void rockchip_crtc_wait_for_update(struct drm_crtc *crtc)
 }
 
 static void
-rockchip_atomic_wait_for_complete(struct drm_atomic_state *old_state)
+rockchip_atomic_wait_for_complete(struct drm_device *dev, struct drm_atomic_state *old_state)
 {
 	struct drm_crtc_state *old_crtc_state;
 	struct drm_crtc *crtc;
@@ -194,6 +194,10 @@ rockchip_atomic_wait_for_complete(struct drm_atomic_state *old_state)
 		if (!crtc->state->active)
 			continue;
 
+		if (!drm_atomic_helper_framebuffer_changed(dev,
+				old_state, crtc))
+			continue;
+
 		ret = drm_crtc_vblank_get(crtc);
 		if (ret != 0)
 			continue;
@@ -241,7 +245,7 @@ rockchip_atomic_commit_complete(struct rockchip_atomic_commit *commit)
 
 	drm_atomic_helper_commit_planes(dev, state, true);
 
-	rockchip_atomic_wait_for_complete(state);
+	rockchip_atomic_wait_for_complete(dev, state);
 
 	drm_atomic_helper_cleanup_planes(dev, state);
 
-- 
2.7.0.226.gfe986fe

WARNING: multiple messages have this Message-ID (diff)
From: John Keeping <john@metanate.com>
To: Mark yao <mark.yao@rock-chips.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH v2 2/3] drm/rockchip: don't wait for vblank if fb hasn't changed
Date: Tue, 19 Jan 2016 10:46:59 +0000	[thread overview]
Message-ID: <6865056b134065bcc8fff798314945e2ba5318cf.1453200263.git.john@metanate.com> (raw)
In-Reply-To: <cover.1453200263.git.john@metanate.com>
In-Reply-To: <cover.1453200263.git.john@metanate.com>

As commented in drm_atomic_helper_wait_for_vblanks(), userspace relies
on cursor ioctls being unsynced.  Converting the rockchip driver to
atomic has significantly impacted cursor performance by making every
cursor update wait for vblank.

By skipping the vblank sync when the framebuffer has not changed (as is
done in drm_atomic_helper_wait_for_vblanks()) we can avoid this for the
common case of moving the cursor and only need to delay the cursor ioctl
when the cursor icon changes.

We cannot add the check on legacy_cursor_update since that results in
the cursor bo being unreferenced while the hardware may still be reading
it.  Fully supporting unsynced cursor updates is left for the future
when the atomic helper framework supports async updates.

Signed-off-by: John Keeping <john@metanate.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
---
Unchanged since v1.

 drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index f784488..679d23a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -178,7 +178,7 @@ static void rockchip_crtc_wait_for_update(struct drm_crtc *crtc)
 }
 
 static void
-rockchip_atomic_wait_for_complete(struct drm_atomic_state *old_state)
+rockchip_atomic_wait_for_complete(struct drm_device *dev, struct drm_atomic_state *old_state)
 {
 	struct drm_crtc_state *old_crtc_state;
 	struct drm_crtc *crtc;
@@ -194,6 +194,10 @@ rockchip_atomic_wait_for_complete(struct drm_atomic_state *old_state)
 		if (!crtc->state->active)
 			continue;
 
+		if (!drm_atomic_helper_framebuffer_changed(dev,
+				old_state, crtc))
+			continue;
+
 		ret = drm_crtc_vblank_get(crtc);
 		if (ret != 0)
 			continue;
@@ -241,7 +245,7 @@ rockchip_atomic_commit_complete(struct rockchip_atomic_commit *commit)
 
 	drm_atomic_helper_commit_planes(dev, state, true);
 
-	rockchip_atomic_wait_for_complete(state);
+	rockchip_atomic_wait_for_complete(dev, state);
 
 	drm_atomic_helper_cleanup_planes(dev, state);
 
-- 
2.7.0.226.gfe986fe

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

WARNING: multiple messages have this Message-ID (diff)
From: john@metanate.com (John Keeping)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] drm/rockchip: don't wait for vblank if fb hasn't changed
Date: Tue, 19 Jan 2016 10:46:59 +0000	[thread overview]
Message-ID: <6865056b134065bcc8fff798314945e2ba5318cf.1453200263.git.john@metanate.com> (raw)
In-Reply-To: <cover.1453200263.git.john@metanate.com>

As commented in drm_atomic_helper_wait_for_vblanks(), userspace relies
on cursor ioctls being unsynced.  Converting the rockchip driver to
atomic has significantly impacted cursor performance by making every
cursor update wait for vblank.

By skipping the vblank sync when the framebuffer has not changed (as is
done in drm_atomic_helper_wait_for_vblanks()) we can avoid this for the
common case of moving the cursor and only need to delay the cursor ioctl
when the cursor icon changes.

We cannot add the check on legacy_cursor_update since that results in
the cursor bo being unreferenced while the hardware may still be reading
it.  Fully supporting unsynced cursor updates is left for the future
when the atomic helper framework supports async updates.

Signed-off-by: John Keeping <john@metanate.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
---
Unchanged since v1.

 drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
index f784488..679d23a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c
@@ -178,7 +178,7 @@ static void rockchip_crtc_wait_for_update(struct drm_crtc *crtc)
 }
 
 static void
-rockchip_atomic_wait_for_complete(struct drm_atomic_state *old_state)
+rockchip_atomic_wait_for_complete(struct drm_device *dev, struct drm_atomic_state *old_state)
 {
 	struct drm_crtc_state *old_crtc_state;
 	struct drm_crtc *crtc;
@@ -194,6 +194,10 @@ rockchip_atomic_wait_for_complete(struct drm_atomic_state *old_state)
 		if (!crtc->state->active)
 			continue;
 
+		if (!drm_atomic_helper_framebuffer_changed(dev,
+				old_state, crtc))
+			continue;
+
 		ret = drm_crtc_vblank_get(crtc);
 		if (ret != 0)
 			continue;
@@ -241,7 +245,7 @@ rockchip_atomic_commit_complete(struct rockchip_atomic_commit *commit)
 
 	drm_atomic_helper_commit_planes(dev, state, true);
 
-	rockchip_atomic_wait_for_complete(state);
+	rockchip_atomic_wait_for_complete(dev, state);
 
 	drm_atomic_helper_cleanup_planes(dev, state);
 
-- 
2.7.0.226.gfe986fe

  parent reply	other threads:[~2016-01-19 10:48 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 12:53 [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't changed John Keeping
2016-01-13 12:53 ` John Keeping
2016-01-13 12:53 ` John Keeping
2016-01-13 14:23 ` Daniel Vetter
2016-01-13 14:23   ` Daniel Vetter
2016-01-13 14:23   ` Daniel Vetter
2016-01-13 14:34   ` John Keeping
2016-01-13 14:34     ` John Keeping
2016-01-13 14:34     ` John Keeping
2016-01-13 15:40     ` Daniel Vetter
2016-01-13 15:40       ` Daniel Vetter
2016-01-13 15:40       ` Daniel Vetter
2016-01-13 15:55       ` John Keeping
2016-01-13 15:55         ` John Keeping
2016-01-13 15:55         ` John Keeping
2016-01-13 16:21         ` Daniel Vetter
2016-01-13 16:21           ` Daniel Vetter
2016-01-13 16:21           ` Daniel Vetter
2016-01-13 16:40           ` John Keeping
2016-01-13 16:40             ` John Keeping
2016-01-13 16:40             ` John Keeping
2016-01-13 17:19             ` Daniel Vetter
2016-01-13 17:19               ` Daniel Vetter
2016-01-13 17:19               ` Daniel Vetter
2016-01-13 17:39               ` John Keeping
2016-01-13 17:39                 ` John Keeping
2016-01-13 17:39                 ` John Keeping
2016-01-14  1:16                 ` Mark yao
2016-01-14  1:16                   ` Mark yao
2016-01-14  1:16                   ` Mark yao
2016-01-14  8:32                   ` Daniel Vetter
2016-01-14  8:32                     ` Daniel Vetter
2016-01-14  8:32                     ` Daniel Vetter
2016-01-14  8:46                     ` Mark yao
2016-01-14  8:46                       ` Mark yao
2016-01-14  8:46                       ` Mark yao
2016-01-14 14:20                       ` Daniel Vetter
2016-01-14 14:20                         ` Daniel Vetter
2016-01-14 14:20                         ` Daniel Vetter
2016-01-14 14:39                         ` [PATCH 0/3] drm/rockchip: fix cursor performance with atomic John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-19 10:46                           ` [PATCH v2 " John Keeping
2016-01-19 10:46                             ` John Keeping
2016-01-19 10:46                             ` John Keeping
2016-01-21  0:51                             ` Mark yao
2016-01-21  0:51                               ` Mark yao
2016-01-21  0:51                               ` Mark yao
2016-01-19 10:46                           ` [PATCH v2 1/3] drm/atomic-helper: Export framebuffer_changed() John Keeping
2016-01-19 10:46                             ` John Keeping
2016-01-19 10:46                             ` John Keeping
2016-01-19 11:03                             ` Daniel Vetter
2016-01-19 11:03                               ` Daniel Vetter
2016-01-19 11:03                               ` Daniel Vetter
2016-01-19 10:46                           ` John Keeping [this message]
2016-01-19 10:46                             ` [PATCH v2 2/3] drm/rockchip: don't wait for vblank if fb hasn't changed John Keeping
2016-01-19 10:46                             ` John Keeping
2016-01-19 10:47                           ` [PATCH v2 3/3] drm/rockchip: explain why we can't wait_for_vblanks John Keeping
2016-01-19 10:47                             ` John Keeping
2016-01-19 10:47                             ` John Keeping
2016-01-14 14:39                         ` [PATCH 1/3] drm/atomic-helper: Export framebuffer_changed() John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-14 14:56                           ` Daniel Vetter
2016-01-14 14:56                             ` Daniel Vetter
2016-01-14 14:56                             ` Daniel Vetter
2016-01-14 14:39                         ` [PATCH 2/3] drm/rockchip: don't wait for vblank if fb hasn't changed John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-14 14:39                         ` [PATCH 3/3] drm/rockchip: explain why we can't wait_for_vblanks John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-14 14:39                           ` John Keeping
2016-01-14 14:57                           ` Thierry Reding
2016-01-14 14:57                             ` Thierry Reding
2016-01-14 14:57                             ` Thierry Reding
2016-01-14 16:26                             ` John Keeping
2016-01-14 16:26                               ` John Keeping
2016-01-14 16:26                               ` John Keeping
2016-01-18  1:40                               ` Mark yao
2016-01-18  1:40                                 ` Mark yao
2016-01-18  1:40                                 ` Mark yao
2016-01-17 15:21 ` [RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't changed Heiko Stuebner
2016-01-17 15:21   ` Heiko Stuebner
2016-01-17 15:21   ` Heiko Stuebner

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=6865056b134065bcc8fff798314945e2ba5318cf.1453200263.git.john@metanate.com \
    --to=john@metanate.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.yao@rock-chips.com \
    --cc=thierry.reding@gmail.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.