mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-04 04:02:26 +00:00
drm/vram: Set GEM object functions for PRIME
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 v3: - move object table to EOF so it can refer to internal interfaces Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190702115012.4418-2-tzimmermann@suse.de
This commit is contained in:
parent
8721215c7e
commit
31070a871f
@ -7,6 +7,8 @@
|
||||
#include <drm/drm_vram_mm_helper.h>
|
||||
#include <drm/ttm/ttm_page_alloc.h>
|
||||
|
||||
static const struct drm_gem_object_funcs drm_gem_vram_object_funcs;
|
||||
|
||||
/**
|
||||
* DOC: overview
|
||||
*
|
||||
@ -80,6 +82,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;
|
||||
@ -639,3 +644,15 @@ int drm_gem_vram_driver_gem_prime_mmap(struct drm_gem_object *gem,
|
||||
return drm_gem_prime_mmap(gem, vma);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_gem_vram_driver_gem_prime_mmap);
|
||||
|
||||
/*
|
||||
* 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
|
||||
};
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user