All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Martin Peres <martin.peres@labri.fr>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 6/7] drm/nouveau: embed gem object in nouveau_bo
Date: Thu, 15 Aug 2013 15:09:06 +0200	[thread overview]
Message-ID: <520CD2F2.9070602@canonical.com> (raw)
In-Reply-To: <CAKMK7uFt7m80ffHFBWXrwxi+r3riGXfkmU6Ur2oQpymc=Y31jw@mail.gmail.com>

Op 15-08-13 14:44, Daniel Vetter schreef:
> On Thu, Aug 15, 2013 at 2:32 PM, David Herrmann <dh.herrmann@gmail.com> wrote:
>>> This would allow ttm to do kref_put((kref_t*)(bo +1), driver->releasefn), where driver->releasefn has to call ttm_bo_release again.
>>> Unfortunately unless drm is fixed dma-buf is still going to be as buggy as before, not much I can do about that. :/
>>> But this is something for a future where dma-buf in drm doesn't suck..
>> This same issue came up with the vma-access-management patches. I
>> dislike adding hacks to TTM to allow accessing the surrounding GEM
>> object only to keep TTM gem-agnostic. We could fix all this with a
>> simple gem_object* pointer in the ttm-bo (or a flag indicating
>> container_of is valid).
>>
>> Or we make gem TTM-aware by optionally embedding either a ttm_bo or a
>> kref object. Hm. Ideas welcome!
Oh original patch:

Acked-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>

I think with this series the normal ttm refcount could be removed entirely. The only place in ttm that
uses it is ttm_bo_mmap and ttm_bo_init. If struct vm_operations_struct is set by the driver the refcount
isn't required in ttm any more at all. The other places in core ttm that use refcount now can be cleaned up.

Radeon was already overriding the mmap ops for ttm, so this could now be done in a cleaner way. :-)

That leaves vmwgfx of course, I'll probably kill ttm_bo_create because that will no longer work without refcount,
and fixup their code.

ttm_bo_io and ttm_bo_fbdev_io can be removed entirely, nothing uses it (I'll send a patch for it).
> Imo embedding a gem bo into a ttm bo should be too harmful. I think we
> already have funny lifetime issues around
> ttm_bo->presistent_swap_storage, so this would imo be a win. Four
> downsides afaik:
> - gem shows up in drm/ttm/ ;-)
> - i915 gem crap like the read/write domains get splattered even more
> around. We could just move them to the i915 gem object struct and call
> it a day I think.
> - vmwgfx doesn't expose a gem interface. Imo this doesn't apply any
> more since we have support for driver private gem objects since a
> while. So shouldn't be too hard to do the final untangling and allow
> non-gem drivers to init gem objects, but not link them up anywhere.
> - gem_object_unref uses dev->struct_mutex. The last reason for that is
> the vma manager (which can be fixed to use the same
> kref_get_unless_zero trick ttm uses) and then the locking pushed down
> into drivers (probably needs a deferred free list to get going).
It's not required to move ttm to gem to kill the refcount. :-)

~Maarten

  reply	other threads:[~2013-08-15 13:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14 13:07 [PATCH 0/7] DRM: Remove gem_init_object() and friends David Herrmann
2013-08-14 13:07 ` [PATCH 1/7] drm/ast: remove unused driver_private access David Herrmann
2013-08-14 13:07 ` [PATCH 2/7] drm/mgag200: " David Herrmann
2013-08-14 13:07 ` [PATCH 3/7] drm/cirrus: " David Herrmann
2013-08-14 13:07 ` [PATCH 4/7] drm/qxl: remove unused object_pin/unpin() helpers David Herrmann
2013-08-14 13:07 ` [PATCH 5/7] drm/radeon: remove stale gem->driver_private access David Herrmann
2013-08-14 13:23   ` Alex Deucher
2013-08-14 13:07 ` [PATCH 6/7] drm/nouveau: embed gem object in nouveau_bo David Herrmann
2013-08-14 14:31   ` Maarten Lankhorst
2013-08-15 12:32     ` David Herrmann
2013-08-15 12:44       ` Daniel Vetter
2013-08-15 13:09         ` Maarten Lankhorst [this message]
2013-09-23 23:15   ` Ben Skeggs
2013-08-14 13:07 ` [PATCH 7/7] drm: kill ->gem_init_object() and friends David Herrmann
2013-08-14 13:27 ` [PATCH 0/7] DRM: Remove gem_init_object() " Daniel Vetter

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=520CD2F2.9070602@canonical.com \
    --to=maarten.lankhorst@canonical.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=martin.peres@labri.fr \
    /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.