From: Eric Anholt <eric@anholt.net>
To: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, boris.brezillon@bootlin.com,
Daniel Vetter <daniel.vetter@ffwll.ch>,
Eric Anholt <eric@anholt.net>
Subject: [PATCH 3/4] drm/v3d: Clean up the reservation object setup.
Date: Thu, 8 Nov 2018 08:16:53 -0800 [thread overview]
Message-ID: <20181108161654.19888-4-eric@anholt.net> (raw)
In-Reply-To: <20181108161654.19888-1-eric@anholt.net>
The extra to_v3d_bo() calls came from copying this from the vc4
driver, which stored the cma gem object in the structs.
Signed-off-by: Eric Anholt <eric@anholt.net>
---
drivers/gpu/drm/v3d/v3d_gem.c | 32 +++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c
index b88c96911453..d0dfdcbbd42c 100644
--- a/drivers/gpu/drm/v3d/v3d_gem.c
+++ b/drivers/gpu/drm/v3d/v3d_gem.c
@@ -214,10 +214,8 @@ v3d_attach_object_fences(struct v3d_exec_info *exec)
int i;
for (i = 0; i < exec->bo_count; i++) {
- bo = to_v3d_bo(&exec->bo[i]->base);
-
/* XXX: Use shared fences for read-only objects. */
- reservation_object_add_excl_fence(bo->resv, out_fence);
+ reservation_object_add_excl_fence(exec->bo[i]->resv, out_fence);
}
}
@@ -228,11 +226,8 @@ v3d_unlock_bo_reservations(struct drm_device *dev,
{
int i;
- for (i = 0; i < exec->bo_count; i++) {
- struct v3d_bo *bo = to_v3d_bo(&exec->bo[i]->base);
-
- ww_mutex_unlock(&bo->resv->lock);
- }
+ for (i = 0; i < exec->bo_count; i++)
+ ww_mutex_unlock(&exec->bo[i]->resv->lock);
ww_acquire_fini(acquire_ctx);
}
@@ -251,13 +246,13 @@ v3d_lock_bo_reservations(struct drm_device *dev,
{
int contended_lock = -1;
int i, ret;
- struct v3d_bo *bo;
ww_acquire_init(acquire_ctx, &reservation_ww_class);
retry:
if (contended_lock != -1) {
- bo = to_v3d_bo(&exec->bo[contended_lock]->base);
+ struct v3d_bo *bo = exec->bo[contended_lock];
+
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
acquire_ctx);
if (ret) {
@@ -270,19 +265,16 @@ v3d_lock_bo_reservations(struct drm_device *dev,
if (i == contended_lock)
continue;
- bo = to_v3d_bo(&exec->bo[i]->base);
-
- ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx);
+ ret = ww_mutex_lock_interruptible(&exec->bo[i]->resv->lock,
+ acquire_ctx);
if (ret) {
int j;
- for (j = 0; j < i; j++) {
- bo = to_v3d_bo(&exec->bo[j]->base);
- ww_mutex_unlock(&bo->resv->lock);
- }
+ for (j = 0; j < i; j++)
+ ww_mutex_unlock(&exec->bo[j]->resv->lock);
if (contended_lock != -1 && contended_lock >= i) {
- bo = to_v3d_bo(&exec->bo[contended_lock]->base);
+ struct v3d_bo *bo = exec->bo[contended_lock];
ww_mutex_unlock(&bo->resv->lock);
}
@@ -303,9 +295,7 @@ v3d_lock_bo_reservations(struct drm_device *dev,
* before we commit the CL to the hardware.
*/
for (i = 0; i < exec->bo_count; i++) {
- bo = to_v3d_bo(&exec->bo[i]->base);
-
- ret = reservation_object_reserve_shared(bo->resv, 1);
+ ret = reservation_object_reserve_shared(exec->bo[i]->resv, 1);
if (ret) {
v3d_unlock_bo_reservations(dev, exec, acquire_ctx);
return ret;
--
2.19.1
next prev parent reply other threads:[~2018-11-08 16:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 16:16 [PATCH 0/4] V3D TFU engine support Eric Anholt
2018-11-08 16:16 ` [PATCH 1/4] drm/v3d: Fix whitespace inconsistency in the header Eric Anholt
2018-11-13 10:22 ` Boris Brezillon
2018-11-08 16:16 ` [PATCH 2/4] drm/v3d: Update a comment about what uses v3d_job_dependency() Eric Anholt
2018-11-13 10:22 ` Boris Brezillon
2018-11-08 16:16 ` Eric Anholt [this message]
2018-11-13 10:22 ` [PATCH 3/4] drm/v3d: Clean up the reservation object setup Boris Brezillon
2018-11-08 16:16 ` [PATCH 4/4] drm/v3d: Add support for submitting jobs to the TFU Eric Anholt
2018-11-13 22:03 ` Eric Anholt
2018-11-28 19:45 ` Dave Emett
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=20181108161654.19888-4-eric@anholt.net \
--to=eric@anholt.net \
--cc=boris.brezillon@bootlin.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.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).