dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: dri-devel@lists.freedesktop.org
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:DRM DRIVER FOR QXL VIRTUAL GPU"
	<virtualization@lists.linux-foundation.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	"open list:DRM DRIVER FOR QXL VIRTUAL GPU"
	<spice-devel@lists.freedesktop.org>,
	Dave Airlie <airlied@redhat.com>
Subject: [PATCH v6 09/10] drm/qxl: simplify qxl_fence_wait
Date: Thu,  4 Feb 2021 15:57:10 +0100	[thread overview]
Message-ID: <20210204145712.1531203-10-kraxel@redhat.com> (raw)
In-Reply-To: <20210204145712.1531203-1-kraxel@redhat.com>

Now that we have the new release_event wait queue we can just
use that in qxl_fence_wait() and simplify the code alot.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/qxl/qxl_release.c | 44 +++----------------------------
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index 43a5436853b7..6ed673d75f9f 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -58,54 +58,18 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr,
 			   signed long timeout)
 {
 	struct qxl_device *qdev;
-	struct qxl_release *release;
-	int count = 0, sc = 0;
-	bool have_drawable_releases;
 	unsigned long cur, end = jiffies + timeout;
 
 	qdev = container_of(fence->lock, struct qxl_device, release_lock);
-	release = container_of(fence, struct qxl_release, base);
-	have_drawable_releases = release->type == QXL_RELEASE_DRAWABLE;
-
-retry:
-	sc++;
 
 	if (dma_fence_is_signaled(fence))
 		goto signaled;
 
 	qxl_io_notify_oom(qdev);
-
-	for (count = 0; count < 11; count++) {
-		if (!qxl_queue_garbage_collect(qdev, true))
-			break;
-
-		if (dma_fence_is_signaled(fence))
-			goto signaled;
-	}
-
-	if (dma_fence_is_signaled(fence))
-		goto signaled;
-
-	if (have_drawable_releases || sc < 4) {
-		if (sc > 2)
-			/* back off */
-			usleep_range(500, 1000);
-
-		if (time_after(jiffies, end))
-			return 0;
-
-		if (have_drawable_releases && sc > 300) {
-			DMA_FENCE_WARN(fence, "failed to wait on release %llu "
-				       "after spincount %d\n",
-				       fence->context & ~0xf0000000, sc);
-			goto signaled;
-		}
-		goto retry;
-	}
-	/*
-	 * yeah, original sync_obj_wait gave up after 3 spins when
-	 * have_drawable_releases is not set.
-	 */
+	if (!wait_event_timeout(qdev->release_event,
+				dma_fence_is_signaled(fence),
+				timeout))
+		return 0;
 
 signaled:
 	cur = jiffies;
-- 
2.29.2

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

  parent reply	other threads:[~2021-02-04 14:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04 14:57 [PATCH v6 00/10] drm/qxl: fix driver shutdown issues Gerd Hoffmann
2021-02-04 14:57 ` [PATCH v6 01/10] [hack] silence ttm fini WARNING Gerd Hoffmann
2021-02-04 14:58   ` Christian König
2021-02-05  7:39     ` Gerd Hoffmann
2021-02-04 14:57 ` [PATCH v6 02/10] Revert "drm/qxl: do not run release if qxl failed to init" Gerd Hoffmann
2021-02-04 18:34   ` Thomas Zimmermann
2021-02-04 18:52     ` Tong Zhang
2021-02-04 19:06       ` Thomas Zimmermann
2021-02-04 20:21         ` Tong Zhang
2021-02-04 14:57 ` [PATCH v6 03/10] drm/qxl: use drmm_mode_config_init Gerd Hoffmann
2021-02-04 14:57 ` [PATCH v6 04/10] drm/qxl: unpin release objects Gerd Hoffmann
2021-02-04 14:57 ` [PATCH v6 05/10] drm/qxl: release shadow on shutdown Gerd Hoffmann
2021-02-04 18:17   ` Thomas Zimmermann
2021-02-04 14:57 ` [PATCH v6 06/10] drm/qxl: properly pin/unpin shadow Gerd Hoffmann
2021-02-04 18:18   ` Thomas Zimmermann
2021-02-04 14:57 ` [PATCH v6 07/10] drm/qxl: handle shadow in primary destroy Gerd Hoffmann
2021-02-04 14:57 ` [PATCH v6 08/10] drm/qxl: properly free qxl releases Gerd Hoffmann
2021-02-04 14:57 ` Gerd Hoffmann [this message]
2021-02-04 14:57 ` [PATCH v6 10/10] drm/qxl: allocate dumb buffers in ram Gerd Hoffmann
2021-02-04 18:22   ` 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=20210204145712.1531203-10-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spice-devel@lists.freedesktop.org \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).