Skip to content

Commit

Permalink
drm: Add default instance for VRAM MM callback functions
Browse files Browse the repository at this point in the history
VRAM MM is most likely be used with GEM VRAM. The latter now provides the
required instance of struct drm_vram_mm_funcs for drivers to use.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20190508082630.15116-8-tzimmermann@suse.de
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
  • Loading branch information
Thomas Zimmermann authored and Gerd Hoffmann committed May 15, 2019
1 parent 96352ec commit 5c9dcac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/gpu/drm/drm_gem_vram_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <drm/drm_gem_vram_helper.h>
#include <drm/drm_mode.h>
#include <drm/drm_prime.h>
#include <drm/drm_vram_mm_helper.h>
#include <drm/ttm/ttm_page_alloc.h>

/**
Expand Down Expand Up @@ -524,6 +525,19 @@ int drm_gem_vram_bo_driver_verify_access(struct ttm_buffer_object *bo,
}
EXPORT_SYMBOL(drm_gem_vram_bo_driver_verify_access);

/**
* drm_gem_vram_mm_funcs - Functions for &struct drm_vram_mm
*
* Most users of @struct drm_gem_vram_object will also use
* @struct drm_vram_mm. This instance of &struct drm_vram_mm_funcs
* can be used to connect both.
*/
const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs = {
.evict_flags = drm_gem_vram_bo_driver_evict_flags,
.verify_access = drm_gem_vram_bo_driver_verify_access
};
EXPORT_SYMBOL(drm_gem_vram_mm_funcs);

/*
* Helpers for struct drm_driver
*/
Expand Down
3 changes: 3 additions & 0 deletions include/drm/drm_gem_vram_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <linux/kernel.h> /* for container_of() */

struct drm_mode_create_dumb;
struct drm_vram_mm_funcs;
struct filp;

#define DRM_GEM_VRAM_PL_FLAG_VRAM TTM_PL_FLAG_VRAM
Expand Down Expand Up @@ -107,6 +108,8 @@ void drm_gem_vram_bo_driver_evict_flags(struct ttm_buffer_object *bo,
int drm_gem_vram_bo_driver_verify_access(struct ttm_buffer_object *bo,
struct file *filp);

extern const struct drm_vram_mm_funcs drm_gem_vram_mm_funcs;

/*
* Helpers for struct drm_driver
*/
Expand Down

0 comments on commit 5c9dcac

Please sign in to comment.