From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: "Michel Dänzer" <michel@daenzer.net>,
"Mike Lothian" <mike@fireburn.co.uk>,
"Christian König" <deathsimple@vodafone.de>,
"Daniel Vetter" <daniel@ffwll.ch>
Cc: Nayan Deshmukh <nayan26deshmukh@gmail.com>,
amd-gfx list <amd-gfx@lists.freedesktop.org>,
dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Before pageflip, also wait for shared dmabuf fences.
Date: Fri, 28 Oct 2016 19:37:28 +0200 [thread overview]
Message-ID: <7eb19a73-a558-d2e6-bd8d-34fe95045dfd@gmail.com> (raw)
In-Reply-To: <720351a2-7597-aee3-58ce-9d65cad5762f@daenzer.net>
[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]
On 10/28/2016 03:34 AM, Michel Dänzer wrote:
> On 27/10/16 10:33 PM, Mike Lothian wrote:
>>
>> Just another gentle ping to see where you are with this?
>
> I haven't got a chance to look into this any further.
>
>
Fwiw., as a proof of concept, the attached experimental patch does work
as tested on Intel HD Haswell + AMD R9 380 Tonga under amdgpu and
DRI3/Present when applied to drm-next (updated from a few days ago).
With DRI_PRIME=1 tearing for page-flipped fullscreen windows is gone
under all loads. The tearing with "windowed" windows now looks as
expected for regular tearing not related to Prime.
ftrace confirms the i915 driver's pageflip function is waiting on the
fence in reservation_object_wait_timeout_rcu() as it should.
That entry->tv.shared needs to be set false for such buffers in
amdgpu_bo_list_set() makes sense to me, as that is part of the buffer
validation for command stream submission. There are other places in the
driver where tv.shared is set, which i didn't check so far.
I don't know which of these would need to be updated with a "exported
bo" check as well, e.g., for video decoding or maybe gpu compute? Adding
or removing the check to amdgpu_gem_va_update_vm(), e.g., made no
difference. I assume that makes sense because that functions seems to
deal with amdgpu internal vm page tables or page table entries for such
a bo, not with something visible to external clients?
All i can say is it fixes 3D rendering under DRI3 + Prime + pageflipping
without causing any obvious new problems.
-mario
[-- Attachment #2: 0001-drm-amdgpu-Attach-exclusive-fence-to-prime-exported-.patch --]
[-- Type: text/x-patch, Size: 3024 bytes --]
>From 2a8d7fcd36da30305fa675df311c697162792597 Mon Sep 17 00:00:00 2001
From: Mario Kleiner <mario.kleiner.de@gmail.com>
Date: Wed, 26 Oct 2016 10:58:00 +0200
Subject: [PATCH] drm/amdgpu: Attach exclusive fence to prime exported bo's.
External clients which import our bo's wait only
for exclusive dmabuf-fences, not on shared ones,
so attach fences on such exported buffers as
exclusive ones, not shared ones.
-> Backup commit. Work in progress.
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c | 5 ++++-
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 6 ++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 3 +++
4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 039b57e..a337d56 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -459,6 +459,7 @@ struct amdgpu_bo {
u64 metadata_flags;
void *metadata;
u32 metadata_size;
+ bool prime_exported;
/* list of all virtual address to which this bo
* is associated to
*/
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
index 651115d..6e1d7b3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -132,7 +132,10 @@ static int amdgpu_bo_list_set(struct amdgpu_device *adev,
entry->priority = min(info[i].bo_priority,
AMDGPU_BO_LIST_MAX_PRIORITY);
entry->tv.bo = &entry->robj->tbo;
- entry->tv.shared = true;
+ entry->tv.shared = !entry->robj->prime_exported;
+
+ if (entry->robj->prime_exported)
+ DRM_DEBUG_PRIME("Exclusive fence for exported prime bo %p\n", entry->robj);
if (entry->robj->prefered_domains == AMDGPU_GEM_DOMAIN_GDS)
gds_obj = entry->robj;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index a7ea9a3..730a68e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -494,6 +494,12 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
tv.bo = &bo_va->bo->tbo;
tv.shared = true;
+
+ if (bo_va->bo->prime_exported) {
+ DRM_DEBUG_PRIME("Update for exported prime bo %p\n", bo_va->bo);
+ /* tv.shared = false; */
+ }
+
list_add(&tv.head, &list);
amdgpu_vm_get_pd_bo(bo_va->vm, &list, &vm_pd);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
index 7700dc2..bfbfeb9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c
@@ -121,5 +121,8 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev,
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm))
return ERR_PTR(-EPERM);
+ bo->prime_exported = true;
+ DRM_DEBUG_PRIME("Exporting prime bo %p\n", bo);
+
return drm_gem_prime_export(dev, gobj, flags);
}
--
2.7.4
[-- Attachment #3: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-10-28 17:37 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 0:14 [PATCH] drm/i915: Before pageflip, also wait for shared dmabuf fences Mario Kleiner
2016-09-08 6:30 ` Chris Wilson
2016-09-08 15:21 ` Mario Kleiner
2016-09-08 16:23 ` Chris Wilson
[not found] ` <20160908162346.GA5479-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2016-09-09 1:15 ` Michel Dänzer
[not found] ` <abccc8ac-10c6-ab22-c59d-f43ee48ba78d-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-13 8:44 ` Christian König
2016-09-13 9:39 ` Chris Wilson
[not found] ` <20160913093945.GA25204-aII6DKEyn0pWYbfKqPwjAkR8Iwp7RQ6xAL8bYrjMMd8@public.gmane.org>
2016-09-13 12:52 ` Christian König
2016-09-21 9:56 ` Michel Dänzer
[not found] ` <7aafce92-8bcf-1c5c-45de-9e8ecda85239-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-21 10:30 ` Christian König
2016-09-21 11:04 ` Daniel Vetter
[not found] ` <CAKMK7uG3j54NzwjxmWuSmP787r+QN-Cu5T8R-naX6S9RvvKemw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-21 11:19 ` Christian König
2016-09-21 12:56 ` Daniel Vetter
[not found] ` <CAKMK7uH6N2Kgwkf-11iwdqDAUrFmreYKLLeTGXmEh+N0DQ4tJg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-09-21 15:07 ` Michel Dänzer
[not found] ` <9d1f4872-cabd-bd1b-7f10-6e4230a1f58c-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-21 15:15 ` Christian König
[not found] ` <5c2048ff-0e20-ddf3-2d73-9a3acb38e7ff-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-21 15:29 ` Michel Dänzer
2016-09-21 16:23 ` Christian König
2016-09-22 6:36 ` Daniel Vetter
[not found] ` <20160922063625.GD22164-XQyZGdhdUcTMwUGJfOwWj/ooFf0ArEBIu+b9c/7xato@public.gmane.org>
2016-09-22 10:55 ` Christian König
2016-09-22 12:26 ` Daniel Vetter
2016-09-22 12:44 ` Christian König
2016-09-22 13:05 ` Daniel Vetter
2016-09-22 13:22 ` Christian König
[not found] ` <d2430ff8-43bd-bff2-9b02-847cabfd56c0-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-09-23 10:00 ` Michel Dänzer
2016-09-23 12:09 ` Daniel Vetter
2016-09-26 0:48 ` Michel Dänzer
2016-09-26 8:04 ` Daniel Vetter
[not found] ` <20160926080419.GV20761-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2016-10-07 12:34 ` Mike Lothian
[not found] ` <CAHbf0-HZ6EotqwgvkxRTdRF97xB3qBA=DRKAzaAXguV_PR_P8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-11 3:58 ` Michel Dänzer
[not found] ` <d74d34a7-5221-d282-d9d1-b0e1007fc0c7-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-10-11 12:04 ` Christian König
[not found] ` <c77a2cb9-1f0e-f1a3-aedd-a111cd6ba8e8-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2016-10-12 0:40 ` Michel Dänzer
2016-10-27 13:33 ` Mike Lothian
[not found] ` <CAHbf0-GGMWZrhB+PKpc-QbD__6fqB4pQVFfN+gzLWNhi+DuG3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-28 1:34 ` Michel Dänzer
2016-10-28 17:37 ` Mario Kleiner [this message]
[not found] ` <7eb19a73-a558-d2e6-bd8d-34fe95045dfd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-28 17:48 ` Christian König
2016-11-05 1:17 ` Mario Kleiner
2016-10-31 6:41 ` Michel Dänzer
2016-10-28 18:37 ` Mike Lothian
2016-10-29 13:58 ` Mike Lothian
[not found] ` <CAHbf0-EY2OM_HgxTjmMi4-f5TQ8fkqf5XYBxHZtJVsnSpxPyyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-31 6:44 ` Michel Dänzer
[not found] ` <c45e2f4c-c075-47b6-7e02-3bd98748c83a-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-10-31 8:00 ` Christian König
2016-10-31 8:06 ` Michel Dänzer
2016-09-22 6:33 ` Daniel Vetter
2016-09-21 15:13 ` Michel Dänzer
[not found] ` <f0e034f9-db22-6577-97c7-dd8d3e851226-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-09-21 15:21 ` Christian König
2016-09-21 15:28 ` Michel Dänzer
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=7eb19a73-a558-d2e6-bd8d-34fe95045dfd@gmail.com \
--to=mario.kleiner.de@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel@ffwll.ch \
--cc=deathsimple@vodafone.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=michel@daenzer.net \
--cc=mike@fireburn.co.uk \
--cc=nayan26deshmukh@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.