PRIME functionality is now provided via the callback functions in struct drm_gem_object_funcs. The driver-structure functions are obsolete. As a side effect of this patch, VRAM-based drivers get basic PRIME support automatically without having to set any flags or additional fields. v2: - use existing PRIME functions for object's table Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> --- drivers/gpu/drm/drm_gem_vram_helper.c | 15 +++++++++++++++ include/drm/drm_gem_vram_helper.h | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c index 4de782ca26b2..b775faf632ed 100644 --- a/drivers/gpu/drm/drm_gem_vram_helper.c +++ b/drivers/gpu/drm/drm_gem_vram_helper.c @@ -14,6 +14,18 @@ * (VRAM). It can be used for framebuffer devices with dedicated memory. */ +/* + * GEM object funcs + */ + +static const struct drm_gem_object_funcs drm_gem_vram_object_funcs = { + .free = drm_gem_vram_driver_gem_free_object_unlocked, + .pin = drm_gem_vram_driver_gem_prime_pin, + .unpin = drm_gem_vram_driver_gem_prime_unpin, + .vmap = drm_gem_vram_driver_gem_prime_vmap, + .vunmap = drm_gem_vram_driver_gem_prime_vunmap +}; + /* * Buffer-objects helpers */ @@ -80,6 +92,9 @@ static int drm_gem_vram_init(struct drm_device *dev, int ret; size_t acc_size; + if (!gbo->gem.funcs) + gbo->gem.funcs = &drm_gem_vram_object_funcs; + ret = drm_gem_object_init(dev, &gbo->gem, size); if (ret) return ret; diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h index 1a0ea18e7a74..bc8fe9feee3b 100644 --- a/include/drm/drm_gem_vram_helper.h +++ b/include/drm/drm_gem_vram_helper.h @@ -127,7 +127,8 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file, .gem_free_object_unlocked = \ drm_gem_vram_driver_gem_free_object_unlocked, \ .dumb_create = drm_gem_vram_driver_dumb_create, \ - .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset + .dumb_map_offset = drm_gem_vram_driver_dumb_mmap_offset, \ + .gem_prime_mmap = drm_gem_prime_mmap /* * PRIME helpers for struct drm_driver -- 2.21.0 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel