diff options
author | Dave Airlie <airlied@redhat.com> | 2019-04-18 17:10:40 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2019-04-24 12:33:15 +1000 |
commit | 61ae227032e7f9278cc7d7224045e77e0dedb33e (patch) | |
tree | 037c9119c6c97c362294c24bc7d890a679c0bdd3 /drivers/gpu/drm/drm_legacy.h | |
parent | 848ee53894811e8bd3aade86415e6bc0afe5cbd3 (diff) | |
download | linux-61ae227032e7f9278cc7d7224045e77e0dedb33e.tar.bz2 |
drm: allow removal of legacy codepaths (v4.1)
If you don't want the legacy drivers, then lets get rid of all the
legacy codepaths from the core module.
This drop the size of drm.ko for me by about 10%.
380515 7422 4192 392129 5fbc1 ../../drm-next-build/drivers/gpu/drm/drm.ko
351736 7298 4192 363226 58ada ../../drm-next-build/drivers/gpu/drm/drm.ko
v2: drop drm_lock as well, fix some DMA->DRM typos
v3: avoid ifdefs in mainline code
v4: rework ioctl defs
v4.1: fix nouveau Kconfig
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_legacy.h')
-rw-r--r-- | drivers/gpu/drm/drm_legacy.h | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h index d7189aa22a48..0400ed19190e 100644 --- a/drivers/gpu/drm/drm_legacy.h +++ b/drivers/gpu/drm/drm_legacy.h @@ -42,11 +42,19 @@ struct drm_file; #define DRM_KERNEL_CONTEXT 0 #define DRM_RESERVED_CONTEXTS 1 +#if IS_ENABLED(CONFIG_DRM_LEGACY) void drm_legacy_ctxbitmap_init(struct drm_device *dev); void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev); -void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle); void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file); +#else +static inline void drm_legacy_ctxbitmap_init(struct drm_device *dev) {} +static inline void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev) {} +static inline void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file) {} +#endif +void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle); + +#if IS_ENABLED(CONFIG_DRM_LEGACY) int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f); @@ -56,6 +64,7 @@ int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f); +#endif /* * Generic Buffer Management @@ -73,16 +82,20 @@ static inline void drm_legacy_remove_map_hash(struct drm_device *dev) drm_ht_remove(&dev->map_hash); } + +#if IS_ENABLED(CONFIG_DRM_LEGACY) int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); int drm_legacy_addmap_ioctl(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_rmmap_ioctl(struct drm_device *d, void *v, struct drm_file *f); + int drm_legacy_addbufs(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_infobufs(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_markbufs(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_freebufs(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_mapbufs(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_dma_ioctl(struct drm_device *d, void *v, struct drm_file *f); +#endif int __drm_legacy_infobufs(struct drm_device *, void *, int *, int (*)(void *, int, struct drm_buf_entry *)); @@ -91,11 +104,17 @@ int __drm_legacy_mapbufs(struct drm_device *, void *, int *, int (*)(void *, int, unsigned long, struct drm_buf *), struct drm_file *); +#if IS_ENABLED(CONFIG_DRM_LEGACY) void drm_legacy_master_rmmaps(struct drm_device *dev, struct drm_master *master); void drm_legacy_rmmaps(struct drm_device *dev); +#else +static inline void drm_legacy_master_rmmaps(struct drm_device *dev, + struct drm_master *master) {} +static inline void drm_legacy_rmmaps(struct drm_device *dev) {} +#endif -#ifdef CONFIG_DRM_VM +#if IS_ENABLED(CONFIG_DRM_VM) && IS_ENABLED(CONFIG_DRM_LEGACY) void drm_legacy_vma_flush(struct drm_device *d); #else static inline void drm_legacy_vma_flush(struct drm_device *d) @@ -117,28 +136,58 @@ struct drm_agp_mem { }; /* drm_lock.c */ +#if IS_ENABLED(CONFIG_DRM_LEGACY) int drm_legacy_lock(struct drm_device *d, void *v, struct drm_file *f); int drm_legacy_unlock(struct drm_device *d, void *v, struct drm_file *f); void drm_legacy_lock_release(struct drm_device *dev, struct file *filp); +#else +static inline void drm_legacy_lock_release(struct drm_device *dev, struct file *filp) {} +#endif /* DMA support */ +#if IS_ENABLED(CONFIG_DRM_LEGACY) int drm_legacy_dma_setup(struct drm_device *dev); void drm_legacy_dma_takedown(struct drm_device *dev); +#else +static inline int drm_legacy_dma_setup(struct drm_device *dev) +{ + return 0; +} +#endif + void drm_legacy_free_buffer(struct drm_device *dev, struct drm_buf * buf); +#if IS_ENABLED(CONFIG_DRM_LEGACY) void drm_legacy_reclaim_buffers(struct drm_device *dev, struct drm_file *filp); +#else +static inline void drm_legacy_reclaim_buffers(struct drm_device *dev, + struct drm_file *filp) {} +#endif /* Scatter Gather Support */ +#if IS_ENABLED(CONFIG_DRM_LEGACY) void drm_legacy_sg_cleanup(struct drm_device *dev); int drm_legacy_sg_alloc(struct drm_device *dev, void *data, struct drm_file *file_priv); int drm_legacy_sg_free(struct drm_device *dev, void *data, struct drm_file *file_priv); +#endif +#if IS_ENABLED(CONFIG_DRM_LEGACY) void drm_legacy_init_members(struct drm_device *dev); void drm_legacy_destroy_members(struct drm_device *dev); void drm_legacy_dev_reinit(struct drm_device *dev); +#else +static inline void drm_legacy_init_members(struct drm_device *dev) {} +static inline void drm_legacy_destroy_members(struct drm_device *dev) {} +static inline void drm_legacy_dev_reinit(struct drm_device *dev) {} +#endif +#if IS_ENABLED(CONFIG_DRM_LEGACY) void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master); +#else +static inline void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master) {} +#endif + #endif /* __DRM_LEGACY_H__ */ |