dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: kraxel@redhat.com, airlied@redhat.com, daniel@ffwll.ch,
	maarten.lankhorst@linux.intel.com, maxime.ripard@bootlin.com,
	sean@poorly.run, sam@ravnborg.org, christian.koenig@amd.com
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH 4/8] drm/ast: Pin framebuffer BO during dirty update
Date: Tue,  4 Jun 2019 17:41:57 +0200	[thread overview]
Message-ID: <20190604154201.14460-5-tzimmermann@suse.de> (raw)
In-Reply-To: <20190604154201.14460-1-tzimmermann@suse.de>

Another explicit lock operation of a GEM VRAM BO is located in AST's
framebuffer update code. Instead of locking the BO, we pin it to wherever
it is.

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

diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 05f45222b702..7d911391c9cf 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -48,32 +48,32 @@ static void ast_dirty_update(struct ast_fbdev *afbdev,
 			     int x, int y, int width, int height)
 {
 	int i;
-	struct drm_gem_object *obj;
 	struct drm_gem_vram_object *gbo;
 	int src_offset, dst_offset;
 	int bpp = afbdev->afb.base.format->cpp[0];
-	int ret = -EBUSY;
+	int ret;
 	u8 *dst;
 	bool unmap = false;
 	bool store_for_later = false;
 	int x2, y2;
 	unsigned long flags;
 
-	obj = afbdev->afb.obj;
-	gbo = drm_gem_vram_of_gem(obj);
+	gbo = drm_gem_vram_of_gem(afbdev->afb.obj);
 
-	/* Try to lock the BO. If we fail with -EBUSY then
-	 * the BO is being moved and we should store up the
-	 * damage until later.
+	/* We pin the BO to system memory so it won't be moved during
+	 * the update and doesn't waste video ram. If the BO is already
+	 * located in VRAM, the pin operation will simply increment the
+	 * pin count.
 	 */
-	if (drm_can_sleep())
-		ret = drm_gem_vram_lock(gbo, true);
-	if (ret) {
-		if (ret != -EBUSY)
-			return;
-
+	if (drm_can_sleep()) {
+		ret = drm_gem_vram_pin(gbo, TTM_PL_FLAG_SYSTEM);
+		if (ret) {
+			if (ret != -EBUSY)
+				return;
+			store_for_later = true;
+		}
+	} else
 		store_for_later = true;
-	}
 
 	x2 = x + width - 1;
 	y2 = y + height - 1;
@@ -126,7 +126,7 @@ static void ast_dirty_update(struct ast_fbdev *afbdev,
 		drm_gem_vram_kunmap(gbo);
 
 out:
-	drm_gem_vram_unlock(gbo);
+	drm_gem_vram_unpin(gbo);
 }
 
 static void ast_fillrect(struct fb_info *info,
-- 
2.21.0

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

  parent reply	other threads:[~2019-06-04 15:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 15:41 Remove explicit locking and kmap arguments from GEM VRAM interface Thomas Zimmermann
2019-06-04 15:41 ` [PATCH 1/8] drm/ast: Unpin cursor BO during cleanup Thomas Zimmermann
2019-06-05  7:45   ` Maarten Lankhorst
2019-06-05  7:56     ` Thomas Zimmermann
2019-06-04 15:41 ` [PATCH 2/8] drm/ast: Remove obsolete or unused cursor state Thomas Zimmermann
2019-06-04 15:41 ` [PATCH 3/8] drm/ast: Pin and map cursor source BO during update Thomas Zimmermann
2019-06-04 15:41 ` Thomas Zimmermann [this message]
2019-06-05  9:46   ` [PATCH 4/8] drm/ast: Pin framebuffer BO during dirty update Gerd Hoffmann
2019-06-04 15:41 ` [PATCH 5/8] drm/mgag200: " Thomas Zimmermann
2019-06-04 15:41 ` [PATCH 6/8] drm/mgag200: Rewrite cursor handling Thomas Zimmermann
2019-06-05  9:58   ` Gerd Hoffmann
2019-06-11 12:31     ` Thomas Zimmermann
2019-06-11 15:33       ` Daniel Vetter
2019-06-12  7:27         ` Thomas Zimmermann
2019-06-12 14:36           ` Daniel Vetter
2019-06-04 15:42 ` [PATCH 7/8] drm: Remove lock interfaces from GEM VRAM helpers Thomas Zimmermann
2019-06-04 15:42 ` [PATCH 8/8] drm: Remove functions with kmap-object argument " Thomas Zimmermann

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=20190604154201.14460-5-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=sam@ravnborg.org \
    --cc=sean@poorly.run \
    /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