From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Gerd Hoffmann <kraxel@redhat.com>,
Thomas Hellstrom <thomas@shipmail.org>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v2 00/18] drm/ttm: make ttm bo a gem bo subclass
Date: Wed, 26 Jun 2019 09:17:51 +0200 [thread overview]
Message-ID: <9beb9916-35cf-045a-4946-ce314cf1d3da@gmail.com> (raw)
In-Reply-To: <20190624063249.x6q5wxq2lrqfoyuw@sirius.home.kraxel.org>
Am 24.06.19 um 08:32 schrieb Gerd Hoffmann:
> Hi,
>
>> Yeah, my point was not really suggesting that we do this, but rather that
>> people would rightfully get upset because the struct contains unused stuff.
> Well, struct drm_gem_object isn't that big, lets have a look:
>
> 320 bytes in total, of which are:
> 184 bytes the embedded vma_mode
> 64 bytes the embedded _resv struct
> 8 bytes the resv pointer.
> 64 bytes everything else.
>
> So, after applying this series it's 64 bytes more per bo for vmwgfx,
> due to some unused fields being added.
>
> And it's 256 bytes less per bo for all ttm+gem drivers, because they
> don't have vma_mode + resv struct + resv pointer twice any more.
>
> And that is just the low-hanging fruit, there is room for more
> ttm_buffer_object elements being removed by using the drm_gem_object
> struct elements instead. num_pages, kref, maybe more.
Yeah, and that is exactly the reason why I'm strongly in favor of this
approach.
GEM is our de-facto standard for buffer UAPI in DRM. AFAIK vmgfx is one
of the few drivers not using it and as you wrote as well it might
actually be a good idea to change that.
The only thing I can of hand see which is misplaced in the
drm_gem_object structure is "struct file *filp;", cause that is specific
to a backend implementation.
Regards,
Christian.
>
>> Also a trap we might end up with in the future is that with the design
>> suggested in this patch series is that people start assuming that the
>> embedded gem object is actually initialized and working, which could lead to
>> pretty severe problems for vmwgfx...
> I guess I should reword patch #1 then, making clear that the
> ttm_bo_uses_embedded_gem_object() helper function is going to stay.
>
> What is the reason for vmwgfx to not use gem btw?
>
>>> for all the ttm+gem drivers, one pointer they don't need twice). With
>>> the side-by-side, which is the design all gem+ttm drivers used the
>>> past few years, we still need that duplication. Same for the vma node
>>> thing, which is also duplicated.
>> To bemore precise I'd probably define a
>>
>> struct drm_bo_common {
>> struct reservation_object r;
>> struct drm_vma_node v;
>> };
>>
>> Embed it in a struct drm_gem_object (and in a struct vmwgfx_buffer_object)
>> and then have a pointer to a struct drm_bo_common in the struct
>> ttm_buffer_object.
> A pointer doesn't cut it.
>
> Beside removing the duplication the other thing I want is to have a
> standard way of finding the ttm_buffer_object for a given drm_gem_object
> for all the ttm+gem drivers. With struct drm_gem_object being embedded
> the usual containter_of() will work.
>
> That'll allow to create drm_gem_ttm_helper.c with helper functions for
> struct drm_gem_object_funcs. For starters some of the current vram
> helpers can become generic ttm helpers because they loose the dependency
> on struct drm_gem_vram_object for finding ttm_buffer_object.
>
>>>> The vmwgfx driver is doing what it does mostly because all buffer
>>>> objects do not need to be user-space visible, and do not need to be
>>>> mapped by user-space. And there are other types of objects that DO need
>>>> to be user-space visible, and that do need to be shared by processes.
>>>> Hence user-space visibility is something that should be abstracted and
>>>> made available to those objects. Not lumped together with all other
>>>> potential buffer object functionality.
> Well, ttm_buffer_object has a vma_node embedded, so it already is
> "lumped together". This patch series only moves it around ...
>
> cheers,
> Gerd
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-06-26 7:17 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 11:57 [PATCH v2 00/18] drm/ttm: make ttm bo a gem bo subclass Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 01/18] drm/ttm: add gem base object Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 02/18] drm/vram: use embedded gem object Gerd Hoffmann
2019-06-28 7:29 ` Thomas Zimmermann
2019-06-28 7:50 ` Daniel Vetter
2019-06-21 11:57 ` [PATCH v2 03/18] drm/qxl: " Gerd Hoffmann
[not found] ` <20190621115755.8481-1-kraxel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-06-21 11:57 ` [PATCH v2 04/18] drm/radeon: " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 05/18] drm/amdgpu: " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 06/18] drm/nouveau: " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 12/18] drm/radeon: switch driver from bo->resv to bo->base.resv Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 07/18] drm/ttm: use gem reservation object Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 08/18] drm/ttm: use gem vma_node Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 09/18] drm/vram: drop drm_gem_vram_driver_gem_prime_mmap Gerd Hoffmann
2019-06-28 7:30 ` Thomas Zimmermann
2019-06-21 11:57 ` [PATCH v2 10/18] drm/ttm: set both resv and base.resv pointers Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 11/18] drm/ttm: switch ttm core from bo->resv to bo->base.resv Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 13/18] drm/vmwgfx: switch driver " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 14/18] drm/amdgpu: " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 15/18] drm/nouveau: " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 16/18] drm/qxl: " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 17/18] drm/virtio: " Gerd Hoffmann
2019-06-21 11:57 ` [PATCH v2 18/18] drm/ttm: drop ttm_buffer_object->resv Gerd Hoffmann
2019-06-21 13:48 ` [PATCH v2 00/18] drm/ttm: make ttm bo a gem bo subclass Christian König
2019-06-21 16:31 ` Daniel Vetter
2019-06-21 15:12 ` Thomas Hellström (VMware)
2019-06-21 15:57 ` Daniel Vetter
2019-06-21 22:52 ` Thomas Hellstrom
2019-06-22 9:18 ` Daniel Vetter
2019-06-22 19:14 ` Thomas Hellstrom
2019-06-24 6:32 ` Gerd Hoffmann
2019-06-26 7:17 ` Christian König [this message]
2019-06-24 8:39 ` Daniel Vetter
2019-06-27 7:32 ` Daniel Vetter
2019-06-27 12:22 ` Gerd Hoffmann
2019-06-27 15:57 ` 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=9beb9916-35cf-045a-4946-ce314cf1d3da@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=thomas@shipmail.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