[RFC 0/3] drm/gem: Add drm_gem_object_funcs
Noralf Trønnes
noralf at tronnes.org
Fri Sep 21 16:42:27 UTC 2018
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).
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
More information about the dri-devel
mailing list