[RFC 0/3] drm/gem: Add drm_gem_object_funcs
Daniel Vetter
daniel at ffwll.ch
Sat Sep 22 10:04:02 UTC 2018
On Fri, Sep 21, 2018 at 06:42:27PM +0200, Noralf Trønnes wrote:
> Hi,
>
> I've found it odd that the GEM object has its callbacks on drm_driver
> and not a vtable of its own. But something being odd isn't enough to
> make a change (me thinks).
>
> After working on the GEM shmem helper I saw that a few drivers have
> runtime support for 2 memory types for their buffers (shmem,vram,cma).
> I have realised that if the shmem helper was self contained wrt the
> callbacks, it would be easier for these types of drivers to use the
> helper. All they needed to do was to determine the buffer type on GEM
> object creation time and let the helper handle the rest of the
> callbacks.
>
> No sure if this makes sense or if the approach is to simplistic. Hence
> the RFC.
>
> I've added a patch to give an example of how this would look for the CMA
> helper and vc4 (I'm not volunteering to refactor the CMA helper and
> drivers).
I very much like, the drm_driver dumping ground has been a sore spot for
me for a long time, and the per-object callback structures look so much
nicer in kms. That's why I also really liked moving all the vblank stuff
from drm_driver to the drm_crtc_(helper_)funcs struct.
Cheers, Daniel
>
> Noralf.
>
> Noralf Trønnes (3):
> drm/driver: Add defaults for .gem_prime_export/import callbacks
> drm/gem: Add drm_gem_object_funcs
> drm/cma: Use drm_gem_object_funcs
>
> Documentation/gpu/todo.rst | 7 ++
> drivers/gpu/drm/drm_client.c | 12 ++-
> drivers/gpu/drm/drm_fb_helper.c | 8 +-
> drivers/gpu/drm/drm_gem.c | 108 +++++++++++++++++++++++++--
> drivers/gpu/drm/drm_gem_cma_helper.c | 99 +++++++++----------------
> drivers/gpu/drm/drm_prime.c | 50 +++++++------
> drivers/gpu/drm/vc4/vc4_bo.c | 46 ++++++------
> drivers/gpu/drm/vc4/vc4_drv.c | 26 +------
> drivers/gpu/drm/vc4/vc4_drv.h | 6 +-
> include/drm/drm_drv.h | 4 +
> include/drm/drm_gem.h | 138 +++++++++++++++++++++++++++++++++++
> include/drm/drm_gem_cma_helper.h | 17 +----
> 12 files changed, 350 insertions(+), 171 deletions(-)
>
> --
> 2.15.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list