Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: "Noralf Trønnes" <noralf@tronnes.org>, "Rob Herring" <robh@kernel.org>
Cc: David Lechner <david@lechnology.com>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	intel-gfx@lists.freedesktop.org,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH v5 4/5] drm: Add library for shmem backed GEM objects
Date: Mon, 28 Jan 2019 16:19:24 -0800	[thread overview]
Message-ID: <87lg34s4c3.fsf@anholt.net> (raw)
In-Reply-To: <5471e418-a942-87f0-a24e-5b0f06df95f8@tronnes.org>


[-- Attachment #1.1: Type: text/plain, Size: 4095 bytes --]

Noralf Trønnes <noralf@tronnes.org> writes:

> Den 28.01.2019 21.57, skrev Rob Herring:
>> On Sun, Dec 2, 2018 at 9:59 AM Noralf Trønnes <noralf@tronnes.org> wrote:
>>>
>>>
>>> Den 30.11.2018 00.58, skrev Eric Anholt:
>>>> Daniel Vetter <daniel@ffwll.ch> writes:
>>>>
>>>>> On Wed, Nov 28, 2018 at 01:52:56PM -0800, Eric Anholt wrote:
>>>>>> Daniel Vetter <daniel@ffwll.ch> writes:
>>>>>>
>>>>>>> On Tue, Nov 27, 2018 at 12:38:44PM -0800, Eric Anholt wrote:
>>>>>>>> Daniel Vetter <daniel@ffwll.ch> writes:
>>>>>>>>
>>>>>>>>> On Mon, Nov 26, 2018 at 04:36:21PM -0800, Eric Anholt wrote:
>>>>>>>>>> Noralf Trønnes <noralf@tronnes.org> writes:
>>>>>>>>>>> +static void drm_gem_shmem_vm_close(struct vm_area_struct *vma)
>>>>>>>>>>> +{
>>>>>>>>>>> +      struct drm_gem_object *obj = vma->vm_private_data;
>>>>>>>>>>> +      struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
>>>>>>>>>>> +
>>>>>>>>>>> +      drm_gem_shmem_put_pages(shmem);
>>>>>>>>>>> +      drm_gem_vm_close(vma);
>>>>>>>>>>> +}
>>>>>>>>>>> +
>>>>>>>>>>> +const struct vm_operations_struct drm_gem_shmem_vm_ops = {
>>>>>>>>>>> +      .fault = drm_gem_shmem_fault,
>>>>>>>>>>> +      .open = drm_gem_vm_open,
>>>>>>>>>>> +      .close = drm_gem_shmem_vm_close,
>>>>>>>>>>> +};
>>>>>>>>>>> +EXPORT_SYMBOL_GPL(drm_gem_shmem_vm_ops);
>>>>>>>>>> I just saw a warning from drm_gem_shmem_put_pages() for
>>>>>>>>>> !shmem->pages_use_count -- I think drm_gem_vm_open() needs to
>>>>>>>>>> drm_gem_shmem_get_pages().
>>>>>>>>> Yeah we need a drm_gem_shmem_vm_open here.
>>>>>>>> Adding one of those fixed my refcounting issues, so I've sent out a v6
>>>>>>>> with it.
>>>>>>> Just realized that I've reviewed this patch already, spotted that vma
>>>>>>> management issue there too. Plus a pile of other things. From reading that
>>>>>>> other thread discussion with Noralf concluded with "not yet ready for
>>>>>>> prime time" unfortunately :-/
>>>>>> I saw stuff about how it wasn't usable for SPI because SPI does weird
>>>>>> things with DMA mapping.  Was there something else?
>>>>> Looking through that mail it was a bunch of comments to improve the
>>>>> kerneldoc. Plus a note that buffer sharing/mmap is going to be all
>>>>> incoherent and horrible (but I guess for vkms we don't care that much).
>>>>> I'm just kinda vary of generic buffer handling that turns out to not be
>>>>> actually all that useful. We have lots of deadends and kinda-midlayers in
>>>>> this area already (but this one here definitely smells plenty better than
>>>>> lots of older ones).
>>>> FWIW, I really want shmem helpers for v3d.  The fault handling in
>>>> particular has magic I don't understand, and this is not my first fault
>>>> handler. :/
>>>
>>>
>>> If you can use it for a "real" hw driver like v3d, I think it makes a lot
>>> sense to have it as a helper. I believe udl and a future simpledrm can
>>> also make use of it.
>> 
>> FWIW, I think etnaviv at least could use this too.
>> 
>> I'm starting to look at panfrost and lima drivers and was trying to
>> figure out where to start with the GEM code. So I've been comparing
>> etnaviv, freedreno, and vgem implementations. They are all pretty
>> similar from what I see. The per driver GEM obj structs certainly are.
>> I can't bring myself to just copy etnaviv code over and do a
>> s/etnaviv/panfrost/. So searching around a bit, I ended up on this
>> thread. This seems to be what I need for panfrost (based on my brief
>> study).
>> 
>
> I gave up on this due to problems with SPI DMA.
> Eric tried to use it with vkms, but it failed. On his blog he speculates
> that it might be due to cached CPU mappings:
> https://anholt.github.io/twivc4/2018/12/03/twiv/
>
> For tinydrm I wanted cached mappings, but it might not work that well
> with shmem. Maybe that's why I had problems with SPI DMA.

Actually, for tinydrm buffers that are dma-buf exported through prime, I
really want tinydrm using WC mappings so that vc4 or v3d rendering (now
supported on Mesa master with kmsro) works.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-01-29  0:19 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17 13:04 [PATCH v5 0/5] drm: Add shmem GEM library Noralf Trønnes
2018-10-17 13:04 ` [PATCH v5 1/5] drm/driver: Add defaults for .gem_prime_export/import callbacks Noralf Trønnes
2018-10-17 13:04 ` [PATCH v5 2/5] drm/prime: Add drm_gem_prime_mmap() Noralf Trønnes
2018-10-17 15:22   ` Daniel Vetter
2018-10-17 13:04 ` [PATCH v5 3/5] drm/gem: Add drm_gem_object_funcs Noralf Trønnes
2018-10-22 12:57   ` Christian König
2018-10-23 13:46     ` Daniel Vetter
2018-10-31 23:37   ` Noralf Trønnes
2018-11-01  8:36     ` [Intel-gfx] " Daniel Vetter
2018-10-17 13:04 ` [PATCH v5 4/5] drm: Add library for shmem backed GEM objects Noralf Trønnes
2018-10-17 15:46   ` Daniel Vetter
2018-10-22 14:15     ` Noralf Trønnes
2018-10-23 13:50       ` Daniel Vetter
2018-11-27  0:36   ` Eric Anholt
2018-11-27  8:58     ` [Intel-gfx] " Daniel Vetter
2018-11-27 20:38       ` Eric Anholt
2018-11-28  8:22         ` [Intel-gfx] " Daniel Vetter
2018-11-28 21:52           ` Eric Anholt
2018-11-29  9:17             ` Daniel Vetter
2018-11-29 23:58               ` Eric Anholt
2018-12-02 15:58                 ` Noralf Trønnes
2019-01-28 20:57                   ` [Intel-gfx] " Rob Herring
2019-01-28 21:22                     ` Noralf Trønnes
2019-01-28 22:01                       ` Rob Herring
2019-01-29  0:19                       ` Eric Anholt [this message]
2019-01-29  8:44                         ` [Intel-gfx] " Noralf Trønnes
2018-10-17 13:04 ` [PATCH v5 5/5] drm/tinydrm: Switch from CMA to shmem buffers Noralf Trønnes
2018-10-26 22:38   ` Noralf Trønnes
2018-10-28 20:21     ` David Lechner
2018-10-28 20:46       ` Noralf Trønnes
2018-10-29  9:07         ` Daniel Vetter
2018-10-31 18:41           ` Noralf Trønnes
2018-10-17 13:43 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Add shmem GEM library Patchwork
2018-10-17 14:02 ` ✓ Fi.CI.BAT: success " Patchwork
2018-10-17 17:37 ` ✓ Fi.CI.IGT: " Patchwork

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=87lg34s4c3.fsf@anholt.net \
    --to=eric@anholt.net \
    --cc=david@lechnology.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=noralf@tronnes.org \
    --cc=robh@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tomeu.vizoso@collabora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox